Dataset DATE in url

Hello!

I need a date in the request url of a remote dataset.
When adding {{DATE}} into the url it replaces it with 2023-10-03.
I would need it as 20231003 (without the hyphen).
Is that possible to realize?

You can use java script for that:

// Original date in the "2023-10-03" format
var originalDate = "{{DATE}}";

// Split the date into parts (year, month, and day)
var dateParts = originalDate.split('-');

// Reassemble the date parts in the desired format
var formattedDate = dateParts[0] + dateParts[1] + dateParts[2];

console.log(formattedDate); // Output: "20231003"


Thank you, but how to add it into the url of the remote dataset?

You can use this in your HTML layout, right?

No, I need the dataset url:

here the url needs the date - i marked it.
when using {{DATE}} it replaces it with 2023-10-04 but I need 20231004 without the hyphen.

I think that this is not possible and I need to search for an alternative…

Another question: Can I initiate a request manually? Waiting until the CMS requests takes to long time.

Thank you.

So… i will not be able to help you, i’m sorry

Maybe @natasha can help you out

Hi,

I have “hacked” on file in the docker container:
In the DataSetFactory.php file on line 553 I just removed the hyphens:
$string = str_replace('{{DATE}}', date('Y-m-d'), $string);
changed to
$string = str_replace('{{DATE}}', date('Ymd'), $string);

Now it works.
It is not a clean solution, but I can test it now.

Maybe there is another possibility?
I tried creating a column that formats the date as needed and then using {{COL.NAME}} for it does not work because I do not understand how to use it…

Hi @embedit , in order to use the {{COL.NAME}} replacement you would need to create a separate dataset containing the formula column that formats the date as needed. You would then need to add a single row to this new dataset.

Next, Edit the original Dataset and navigate to the Advanced tab. Click on the drop-down for ‘Depends on Dataset’ and select the new dataset containing the formula, then click on Save.

Now you can add {{COL.NAME}} into the URL where NAME is the name of the formula column in the dependent dataset.

Kind Regards,

Frazer

Hi Frazer,
Thank you, this is a solution.
Now it is running without the “hack”.
I tried the same thing, but with a column in the same dataset. This is not working.

br,
Zoran

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.