1. Tom Holland
  2. .NET DataStore
  3. Tuesday, 22 September 2020 14:43 PM UTC

We are having trouble using the DwNet.Data and SnapObjects.Data and having trouble with Mapping.Method, when using the PowerBuilder RestClient.Submit.  The Mapping.Method is set to 0 and this is causing problems with the processing of the json.  Looks like either DwNet.Data or SnapObject.Data depends on the mapping-method when it deserializes the input json into a datastore/model.

Changing from "mapping-method":0  to "mapping-method":2, then the validation passes and the .NET datastore endpoint works.  Otherwise, the validation fails since the json is incorrectly read and values are mapped to the wrong field.  

Is there a way to change the mapping-method on the PowerBuilder side using RestClient.Submit?  Or is there a standard way to handle this on the .NET side?

Here is the first part of the json with the mapping-method:

{"identity":"removed","version":1,"platform":"PowerBuilder","mapping-method":0,"dataobject":

Here are the options for the mapping-method.  We would like to map to the key of the JSON item:

0 -- Use the index of JSON item to map with the DataWindow column.
1 -- Use the index of meta-columns to map with the DataWindow column.
2 -- Use the key of JSON item to map with the DataWindow column.

Thank you for any help you can provide.

Tom

Tom Holland Accepted Answer Pending Moderation
  1. Wednesday, 23 September 2020 16:39 PM UTC
  2. .NET DataStore
  3. # 1

Thank you Logan,

I have resolved the problem with the index matching.  However, I am concerned that there is no option in the RestClient.Submit to use DataWindow column name matching.  This method will be much more desirable for many reasons.  Index is fragile and may result in mismatch.  Data may be mapped to the wrong column, resulting in data corruption, incorrect business decisions resulting in customer dissatisfaction, etc.  Using DataWindow column matching will ensure the correct data is mapped to the correct column.  

Can you help me understand why mapping-method other than 0 is not supported in RestClient.Submit method?  This is the primary method for us to enhance our PowerBuilder datawindow using the Appeon provided C# datastore and generated models.

Thank you,

Tom

Comment
  1. Logan Liu @Appeon
  2. Friday, 25 September 2020 02:33 AM UTC
Hi Tom,

RestClient.Submit follows the traditional index matching style of PB. If you want this feature, we suggest that you submit an enhancement ticket on our support portal (at https://www.appeon.com/standardsupport). This way, our product team will analyze this request when they plan to extend PB functions in the future.

Regards,

Logan
  1. Helpful
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 23 September 2020 14:09 PM UTC
  2. .NET DataStore
  3. # 2

Hi Tom,

Could you provide a sample project that can duplicate this issue? I dont know why these values were mapped to the wrong field.  

"0 -- Use the index of JSON item to map with the DataWindow column" is the default mapping method in PB when calling RestClient.Submit. If you want to modify "mapping-method":0 to "mapping-method":2, you can also call RestClient.SendPostRequest to send your "modified" JSON data instead of RestClient.Submit. But it's just a work around.

Regards,

Logan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.