Bug- Incorrect behavior of the Exportd mechanism

Hello @mbatz,
i created job exportd for push csv with two field :

one is name (text field)
second is location (reference field)
image

and next i run job and job is done but

I get very strange results
i show you some fields have information in good format some have not good format:

CSV file - details

Field1;Field2
mordor;23
moria;{‘id’: 23, ‘fields’: {‘name’: ‘Czakra’, ‘city’: ‘Biebrza’}}
bree;23
rohan;22
gondor;24
rhovanion;22
arnor;23
eriaddor;{‘id’: 22, ‘fields’: {‘name’: ‘Czochra’, ‘city’: ‘Kluczbork’}}
harondor;23
shire;23
umbar;{‘id’: 22, ‘fields’: {‘name’: ‘Czochra’, ‘city’: ‘Kluczbork’}}
belfalas;23

This is strange bahavior application once time show all information about object second time only its id but this is the same object even if:

mordor;23
moria;{‘id’: 23, ‘fields’: {‘nazwa-serwerowni’: ‘Czakra’, ‘miasto’: ‘Biebrza’}}

Why is that ?

I choose other fields which refers to the reference field and the end result is similar. In some cases the object is shown in braces {} and at other times only id so it is not bug in one case.
I create and run these tests for two different instances and other types, and again this is not a one-time case but it occurs in almost every case.

And this is not a random event, i.e.
for example.
I will run Job once and get the result:
moria; {’id’: 23, ’fields’: {’server-name’: ’Chakra’, ’city’: ’Biebrza’}}

Hi @marcin,

let me explain references in Exportd jobs. If you use references in Exportd jobs, you have the following options for template variables:

# access to the ID of the referenced object
{{fields['location']['id']}}

# access to a field of a referenced object
{{fields['location']['fields']['city']}}

If you access a reference field directly ({{fields}['location']}), you got the pure JSON object. If a reference can not be resolved, the content of the field will be shown (like in your case 23). So in your case, it seems that some references can not be resolved. Can you recheck your objects in the UI, are the references in the UI are working correctly?

Hi,
I know that if I access a reference field directly ({{fields}[‘location’]}), i got the pure JSON object.
I deliberately entered a reference field directly ({{fields} [‘location’]}) because I thought it was the best way to describe the situation I have.

moria;{‘id’: 23, ‘fields’: {‘name’: ‘Czakra’, ‘city’: ‘Biebrza’}}
bree;23

23 and {‘id’: 23, ‘fields’: {‘name’: ‘Czakra’, ‘city’: ‘Biebrza’}} Is the same object.
How a reference can’t resolve?
From every these objects which i got in csv i can normally move to object with this id:23 in the UI in datagerry

Hi @marcinw,

ok, let’s debug that situation. Can you connect to the MongoDB database and query for the two objects “moria” and “bree”? Just execute the following query. Instead of “1234” fill in the object ID of moria and bree:

db.framework.objects.find({"public_id": 1234}).pretty();

Also query for the type of moria and bree. Just fill in the type id of moria and bree instead of “1235”
db.framework.types.find({"public_id": 1235}).pretty();

Okay,
I made inquiries and got the results:

First object moria id 244

{
“_id” : ObjectId(“5ec76e132a12d91e4cc72c4e”),
“type_id” : 6,
“status” : null,
“version” : “1.0.0”,
“creation_time” : ISODate(“2020-05-22T06:15:47.847Z”),
“author_id” : 4,
“last_edit_time” : null,
“active” : true,
“fields” : [
{
“name” : “nazwa-serwera”,
“value” : “moria”
},
{
“name” : “admin-podstawowy”,
“value” : “Administrator Windows”
},
{
“name” : “system-operacyjny”,
“value” : 19
},
{
“name” : “lokalizacja”,
“value” : 23
},
{
“name” : “notatki”,
“value” : “”
},
{
“name” : “administrator-podstawowy”,
“value” : null
},
{
“name” : “wartosc-dla-subskrypcji-redhat”,
“value” : “0,5”
}
],
“public_id” : 244
}

Second object bree id 200

{
“_id” : ObjectId(“5ec76e132a12d91e4cc72c52”),
“type_id” : 6,
“status” : null,
“version” : “1.0.0”,
“creation_time” : ISODate(“2020-05-22T06:15:47.849Z”),
“author_id” : 4,
“last_edit_time” : null,
“active” : true,
“fields” : [
{
“name” : “nazwa-serwera”,
“value” : “bree”
},
{
“name” : “admin-podstawowy”,
“value” : “Administrator Linux”
},
{
“name” : “system-operacyjny”,
“value” : 167
},
{
“name” : “lokalizacja”,
“value” : 23
},
{
“name” : “notatki”,
“value” : “OSK Cessot”
},
{
“name” : “administrator-podstawowy”,
“value” : 219
},
{
“name” : “wartosc-dla-subskrypcji-redhat”,
“value” : “0,5”
}
],
“public_id” : 200
}

Location Czakra id 23

{
“_id” : ObjectId(“5e722cb32a12d91bcbeac46b”),
“type_id” : 9,
“status” : true,
“version” : “3.0.0”,
“creation_time” : ISODate(“2020-03-18T14:14:11.470Z”),
“author_id” : 4,
“last_edit_time” : ISODate(“2020-07-09T07:17:05.646Z”),
“active” : true,
“fields” : [
{
“name” : “nazwa-serwerowni”,
“value” : “Czakra”
},
{
“name” : “miasto”,
“value” : “Biebrza”
}
],
“public_id” : 23,
“views” : 0
}

Thanks for sending the information. Unfortunately, I cannot reproduce the behavior yet in my testing environment. Can you please also send me the type definitions for the objects?

db.framework.types.find({"public_id": 6}).pretty();
db.framework.types.find({"public_id": 9}).pretty();

If you don’t want to share it public, just send me a PN.

It will be better:)
i will send you these types.

Additionally, I would like to write that it is not the only situation when the entire object is shown in the direct reference field, and not for another object.
There are other types of objects from which, when making reports, I found that once they show up, and other times the data about the object referenced by the field is not showing

@mbatz I sent you private message

Hi @marcinw,

thanks for sending me your type definitions. This brought me to the idea of what is going wrong in Exportd. The problem appears on object types with more than 3 reference fields, so the 4th reference field is not resolved correctly in Exportd. I opened an issue for that in [NET-476] and created a bugfix. This fix will be included in the upcoming 1.3 release, which we will release next week (at 21st Aug 2020). Thanks for testing and sharing the information with us.

Hi @mbatz,
good news that you discovered what was wrong and created a bugfix.
I will wait for new version