Skip to main content
Solved

Nested fields filtering in RSD file.


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

Best answer by Thomas Lind

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.

View original
Did this topic help you find an answer to your question?

7 replies

Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 1015 replies
  • May 11, 2023

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”


  • Author
  • Starter
  • 3 replies
  • May 11, 2023

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:

 


Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 1015 replies
  • May 11, 2023

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


  • Author
  • Starter
  • 3 replies
  • May 11, 2023

Hi Thomas,

Sent the file.


Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 1015 replies
  • Answer
  • May 17, 2023

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.


  • Author
  • Starter
  • 3 replies
  • May 20, 2023

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!


Thomas Lind
Community Manager
Forum|alt.badge.img+5
  • Community Manager
  • 1015 replies
  • May 22, 2023

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings