Skip to main content
Solved

Pass TimeXtender variable value to CData REST provider rsd file

  • September 22, 2022
  • 1 reply
  • 244 views

We have a REST API that we are calling and setting up pagination on, so we are using an rsd file.  We need to pass a calculated date (milliseconds since 1970) to the API call.  I think we might need to reference a stored date of our last data extraction and then calculate the proper date to pass to the REST API.  I am thinking we might do that in TX, but I am unclear how we can then pass a TX variable value in to the rsd file so we can put it into the query string of the API call.  Any pointers that can be provided would be appreciated.

Thanks!

Best answer by Thomas Lind

From an Zendesk ticket made regarding this topic.

Hi Daniel
 
If you are using a Business Unit the following guide can help.
https://legacysupport.timextender.com/hc/en-us/articles/360052383191-Creating-and-using-RSD-files-for-CData-providers#parameters
 
There is a reason why it is at the bottom of the article, as it was the first method I learned and I have since found other methods that worked better.
Also, you can't use parameters such as this with the ODX.
 
You can add a dynamic date as a parameter, what I got in the guide needs to be changed a bit to use for you.
https://legacysupport.timextender.com/hc/en-us/articles/360052383191-Creating-and-using-RSD-files-for-CData-providers#create-an-dynamic-date-range-filter
 
You can probably use datediff instead. It will return a number

[attr | datediff([interval][, value][, inputformat])]

Returns the difference (in units specified by the first parameter) between now and the date specified by the second parameter.
  • interval: The optional interval you want the result in. Specify day, hour, minute, second, or millisecond.
  • value: The optional string representation of the date to compare with attribute value. Default is now.
  • inputformat: The optional input format specifier. Default is autodetected.

I suppose it would be something like
<api:set attr="Start" value="1970-01-01" />
<api:set attr="range" value="[dummy | [Start] | datediff('milisecond',date('yyyy-MM-dd'))"/>
 
I hope it makes sense.
 
Venlig hilsen / Best regards
Thomas Lind

Thank you Thomas.

I did finally find the article with passing the parameter. I think I have that working now (with just a hard-coded value being passed in). The other information you provided I think will help with calculating the appropriate value to pass.

Thank you again.

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

1 reply

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

From an Zendesk ticket made regarding this topic.

Hi Daniel
 
If you are using a Business Unit the following guide can help.
https://legacysupport.timextender.com/hc/en-us/articles/360052383191-Creating-and-using-RSD-files-for-CData-providers#parameters
 
There is a reason why it is at the bottom of the article, as it was the first method I learned and I have since found other methods that worked better.
Also, you can't use parameters such as this with the ODX.
 
You can add a dynamic date as a parameter, what I got in the guide needs to be changed a bit to use for you.
https://legacysupport.timextender.com/hc/en-us/articles/360052383191-Creating-and-using-RSD-files-for-CData-providers#create-an-dynamic-date-range-filter
 
You can probably use datediff instead. It will return a number

[attr | datediff([interval][, value][, inputformat])]

Returns the difference (in units specified by the first parameter) between now and the date specified by the second parameter.
  • interval: The optional interval you want the result in. Specify day, hour, minute, second, or millisecond.
  • value: The optional string representation of the date to compare with attribute value. Default is now.
  • inputformat: The optional input format specifier. Default is autodetected.

I suppose it would be something like
<api:set attr="Start" value="1970-01-01" />
<api:set attr="range" value="[dummy | [Start] | datediff('milisecond',date('yyyy-MM-dd'))"/>
 
I hope it makes sense.
 
Venlig hilsen / Best regards
Thomas Lind

Thank you Thomas.

I did finally find the article with passing the parameter. I think I have that working now (with just a hard-coded value being passed in). The other information you provided I think will help with calculating the appropriate value to pass.

Thank you again.


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