String manipulation

Hi,
I need to modify the following string by adding the column Date to the string.
What is the easiest way to get this done? :slight_smile: Tried string manipulation, but was not able to get this to work :see_no_evil:

{ “fromdate”: “2000-01-01”, “todate”: “2030-12-31”,“asofdate”: $Date$,“datagroupings”: 4}

Hi @Data_consumer, so do you currently have the string in json format and you want to insert the value of $Date$ into it at the position shown, or are you trying to create the entire string from scratch?

HI @Takbb!

I’m trying to create it from scratch… the $date$ is the only “data”, the rest is added (typed to string manipulation node) need the string for a post call body…

Thanks!

Ok, the other question I should have asked: is the Date column actually a Date datatype or is it already a string in the required format?

  • actually I don’t think it matters as if it is a Local Date column, the format you are producing yyyy-MM-dd is what will output anyway.

Try this:

join("{ \"fromdate\": \"2000-01-01\", \"todate\": \"2030-12-31\",\"asofdate\": \"",$Date$,"\",\"datagroupings\": 4}")

(every double quote within the string needs to be escaped as shown. Is that what was causing the problem?)

1 Like

@takbb works like a charm! :slight_smile: The double quotes we the ones giving me the trouble, learned that one also now!

Thanks & enjoy the weekend!! :slight_smile:

1 Like

Glad it worked for you @Data_consumer. Have a good weekend too.

And thanks for marking the solution. :slight_smile:

1 Like

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