Display of Association Field also 403 PUT Error

I have a Web Core application that accesses data from a XData server using a TXDataWebDataSet. I can associated data for the DataSet but have some issues.  I set the datafield property of an association field and am unable to display its value.  I am unable to display values from the associated table, I get a PUT error when I try to ApplyUpdates.


1)  I cannot display the value of the data field associated with the join for the association.

a)  When I use expand the TWebDBLabel value shows "[object]".
b)  When I don't use expand the value is null.

How do I display the value of the field in the primary table (AccountNo in my example)?

2)  I cannot find a way to display any of the values in the associated table even though I can see them in the JSON.

Can I specifiy a DataField value that will display the associated fields (AccountName in my example)?

3)  I can make changes in the client but when I ApplyUpdates, I get this errror:
403 Forbidden on PUT /tms/xdata/renewals/api/requests(6789) HTTP/1.1

The documentation clearly says use TXDataWebDataSet.ApplyUpdates to write the results back to the server.

What needs to be done to resolve the 403 error?

Thanks

The data is loaded using a TXDataWebDataSet
RequestId := JS.toString(AuthService.TokenPayload.Properties['user']);
QueryStringText   MyDataset.QueryString 
  := '$filter=startswith(RequestNo,'+QuotedStr(RequestId)+')&$expand=AccountNo';
MyDataset.Load;

Manual Accessed Results
I removed JWT middleware from the server so I could manually test the query using:

Partial JSON returned:
{
"value": [
{
"$id": 1,
"REQUESTNO": 7689,
"IPADDRESS": "1.2.3.4",
"ACCOUNTNO": {
"$id": 2,
"ACCOUNTNO": 87654321,
"ACCOUNTNAME": "TEST ACCOUNT"
}
}
]
}

I was able to resolve all issues related to field values.


The solution in my case was
1)  Set TXDataWebDataSet.SubpropsDepth property to 1
2)  Add $expand=accountno parameter to the end of the TXDataWebDataSet.QueryString

I have not resolved the 403 error but I suspect it is a JWT issue.

As expected, the 403 error was caused by a problem with the JWT setup.  JWT middleware had been removed from the XDataServer so I could manually make sure fields were being sent with $EXPAND.  When JWT middleware was added back to the XDataServer, the 403 error went away.


All  issues are resolved, thanks.

Thanks for feedback Sidney. 

Alternatively to set SubpropsDepth to 1, you can manually add the subproperty fields you need, e.g., "accountno.name"