Skip to content
+1-888-319-3663

COMMUNITY FORUM

Rest Connector Use Dynamic Dates

Steven Messier asked 3 years ago
I’m trying to figure out a way to have two dynamic dates as parameters in an API call using the Rest connector. The dates would be the previous day’s date and the current date. I need to have them formatted like “2019-02-26”. Currently I’m just going in and changing the parameter values for my mappings each morning. If anyone has any experience doing something like I’ve described I’d appreciate the help.
Answers
Best Answer
Steven Messier answered 3 years ago
I figured out how to do this by altering the table where the parameter values were stored. I run a SQL stored procedure every morning that updates the values in the table RestDataSourceCondition.
Ethan Sorenson Staff answered 3 years ago
Steven,
 
You can change these values in the RestParameterBase table. I would create a map with that table as bothe data source and destination. Then in the destination map the RestParameterBaseId and group on it to tell SmartConnect to update that record. Then use a calculated column like this:
 
If _RestParameterBaseId = “40B48C11-411E-473B-A700-A9DC009B479C” then
return DateTime.Now.ToString(“yyyy-MM-dd”)
else
return DateTime.Now.AddDays(-1).ToString(“yyyy-MM-dd”)
End If
Steven Messier replied 3 years ago

Where would I find the RestParameterBase table? I tried digging around in the Program Files and didn’t see any files with Parameter in the name. I’m using SmartConnect verison 20.17.0.17.

Ethan Sorenson Staff replied 3 years ago

Steven,

The RestParameterBase table is in the SmartConnect SQL database.

Steven Messier replied 3 years ago

I’ve got the mapping set up for the RestParameterBase table and can confirm it’s updating the dates. How do I ensure that my mappings use the new default parameter when the maps run each day? I looked at a mapping where I left the parameters as the default values and even after running the RestParameterBase mapping to change the dates, the dates on the mapping still has the old default values.

Steven Messier replied 3 years ago

I can’t figure out how to get the parameter values to update on the mappings. I’ve tried leaving the parameters blank in the mapping in hopes that it would use the default values, but that just leaves the parameters blank when the mapping runs.

I’m so close to having this figured out, I just can’t get the updated parameters to populate the values in the mapping.


If you would like to submit an answer or comment, please sign in to the eOne portal.