You can translate the question and the replies:

Interpolation Variable using a formula - Julian calendar date

I have a data source which requres a dynanmic file name to be reference using a Julian date - last two digits of the year and the current day number. So 2022-04-04 would be 22094. Is there an easy way to include this value as part of the interpolation variable? I am not sure of any easy way to join this in view another view since it is being created dynamically. This is the current data source URL with the variable: https://api.sam.gov/data-services/v1/extracts?api_key=keyvalue&fileName=SAM_Exclusions_Public_Extract_@{date}.ZIP I need that 22094 to be calculated (I can do this with date functions) but not sure how to incoroporate it into the datasource/views.
user
05-04-2022 12:01:37 -0400
code

1 Answer

Hi, Yes, you could pass an interpolation variable using a formula to obtain the filename dynamically. For instance, to read a file with a dynamic filename located at a remote location, you could do the following: * Create the required data source based on your file type and select **HTTP client** as the data route while configuring the data source. To pass the file name dynamically, you can use the interpolation variable in the file path URL as follows: ` https://acme.com/files?&filename=@{fileparam}.zip` * Here @fileparam is the interpolation variable which means that the string @{fileparam} will be replaced at runtime by the value of the variable. You can refer to the section [Paths and Other Values with Interpolation Variables](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_data_sources_and_base_views/path_types_in_virtual_dataport/path_types_in_virtual_dataport#paths-and-other-values-with-interpolation-variables) of the Virtual DataPort Administration Guide for more information on interpolation variable in the file path. * Now, you must pass a sample value to the field fileparam(interpolation variable) to create the base view. * After creating a base view, you can pass the filenames dynamically in the where clause to query the base view. To calculate the JULIAN date, you could use the [DateTime](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/datetime_functions/datetime_functions#datetime-functions) and [Text](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/text_functions/text_functions#text-functions) functions such as GETDAYOFYEAR, GETYEAR, SUBSTR, CONCAT, etc in the where clause. Hope this helps!
Denodo Team
06-04-2022 09:07:18 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here