on 2024 Oct 14 1:53 PM
Hello community,
I would like to share an issue I encountered with entities and their navigation fields.
I have two entities:
There is also a navigation from cust_Turmas to cust_Instrutores, which is called cust_Inst1Nav.
Here is the filter used to retrieve the data using OData:
$select:externalCode,externalName,cust_Inst1Nav/cust_fname,cust_Inst1Nav/cust_lname $expand:cust_Inst1Nav $filter:externalCode eq 235
The URL parameter is:
<BASE_URL>/?$select=externalCode,externalName,cust_Inst1Nav/cust_fname,cust_Inst1Nav/cust_lname&$expand=cust_Inst1Nav&$filter=externalCode eq 235
The data retrieved by the query is:
{ "@odata.context": "$metadata#cust_Turmas", "value": [ { "externalCode": "235", "externalName": "Course name", "cust_Inst1Nav": { "externalCode": "123", "cust_fname": "Victor", "cust_lname": "Cardoso" } } ] }
I thought I could simply call the navigation fields as I do with the main entity. For example:
However, the navigation fields are not being retrieved.
Is there something I'm missing?
This is my page:
Here is my Target object configuration detailed.
I can see the fields inside entity "cust_Turmas" its navigation "cust_Inst1Nav" when I want to set a field value in my objects.
I've created a rule to get me some clues and put in a field:
export default function checkEmpty(context) { let binding = context.binding; if (binding.cust_Inst1Nav) { if (binding.cust_Inst1Nav.cust_lname) { return binding.cust_Inst1Nav.cust_lname; } else { return 'No Last Name Available'; } } else { return 'cust_Inst1Nav not available'; } }
The result is: cust_Inst1Nav not available
I appreciate any comments/suggestions.
Request clarification before answering.
Are you using Offline OData?
If you are using offline the other thing to verify is that the $expand entity set is included in the defining requests in your Initialize action. When I was running a test I didn't have my $expand entity set defined so naturally got no data back for the expand.
You can set your "SecureDatabaseEncryptionKey": false in your BrandedSettings.json and then pull the offline db files from your simulator/emulator and open in ilodata directly to confirm what data in in the offline store.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.