Solved

Nested fields filtering in RSD file.

  • 11 May 2023
  • 7 replies
  • 174 views

Hi,

I have a problem with data catching from JSON file. The file looks like this:

And I would like to get values from data field but only for en_US locale.

I was trying to add filter in RSD file like below but it did not help:

Can that type of filtering be used there?

Greets, Aleksei

icon

Best answer by Thomas Lind 17 May 2023, 11:24

View original

7 replies

Userlevel 6
Badge +5

Hi Aleksei

You can get all the pot_life data if you point to that part with the JSONPath option before generating the RSD file. You then add a filter based on this table for the locale field and specify that it needs to be locale=en_US.

https://cdn.cdata.com/help/DJH/ado/pg_customschemaselect.htm#process-select-where-on-the-server

Essentially it can be

SELECT * FROM rest.pot_life WHERE Locale = “en_US”

But the problem is that there are a lot of columns where locale filter should be implemented. Might be too time expensive to create separate table for every of it:

 

Userlevel 6
Badge +5

Hi Aleksei

Can I try it out myself with a JSON file?

You can send it to support@timextender.com with a reference to this URL

Hi Thomas,

Sent the file.

Userlevel 6
Badge +5

Hi Aleksei

I found a way to merge across.

<api:set attr="JSONPath" value="$.values.*"/>

Then you get a table containing locale, scope and schema. You will see all rows across the values and can add a filter to only get the en_US rows.

Hello,
Did try it but this gives me only that particular table which i can then filter. So I basically need to do the same for all the rest columns which should be also separated and filtered. Ok, will do it that way.

Thank you for your help!

Userlevel 6
Badge +5

Hi Aleksei

OK, I asked the same question, more or less, to CData. Here is their response.

Are you saying they need the path to that JSON object to be returned as an additional column and they need the results of a query to be something like this?
locale: null, scope: null, data: FALSE, path: /values/ce/

If that is what they need, I don't think there is any easy way to implement that, but I can look into if this is something that can be done with an RSD file. If this is not what they are looking for, could you provide me an example of how your customer is expecting the data to be formatted?

So I asked for that, but I assume it could be done many ways.

Reply