- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Integer to String data type conversion in JSL
Hi, This is my first post in the forums.
I am attempting to concatenate a number to a string for the purpose of saving a timestamp to an image name like so:
ChartName << save picture ("file_name" || "date" || ".png", png);
However, JSL will not allow the date information to be concatenated because it is an integer and not a string.
I gather datetime information using
yyyy = year(today());
hh = hour(today());
and so on which returns integer data types.
Is there a way to convert the integer datetime information to strings so that they can be concatenated with the string for the file name? I did not see any information in the scripting guide on data type conversions.
Thanks.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Integer to String data type conversion in JSL
You need to remove the double quotes around timeString, as it's a variable:
currentTime = today();
timeString = format(currentTime, "yyyy-mm-dd");
ChartName << save picture ("file_name" || timeString || ".png", png);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Integer to String data type conversion in JSL
I figured it out from reading another post.
currentTime = today();
timeString = format(currentTime, "yyyy-mm-dd");
ChartName << save picture ("file_name" || "timeString" || ".png", png);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Integer to String data type conversion in JSL
You need to remove the double quotes around timeString, as it's a variable:
currentTime = today();
timeString = format(currentTime, "yyyy-mm-dd");
ChartName << save picture ("file_name" || timeString || ".png", png);