The XML “timestamptype” date/time format is as follows:
Recently during a project of integrating systems together and creating XML files, I’ve had to create this in VBScript and SQL.
Here’s the code:
Year(Now) & "-" & Right("0" & Month(Now),2) & "-" & Right("0" & Day(Now),2) & "T" & Right("0" & Hour(Now),2) & ":" & Right("0" & Minute(Now),2) & ":" & Right("0" & Second(Now),2) & ".000000"
As you can see SQL is a lot cleaner than VBScript!
In Taskcentre, the text parser tool can be used to extract text between set characters.
A good example is if you have the following input data:
<Result>This is a test</Result>
And wish to extract the following text:
This is a test
This is a good tool, however doesn’t handle errors very well. For example, if the text is not found, it will throw an error message (unless you tell it to ignore errors), which may impact other steps. Additionally the extracted string may be needed in the middle of a Web Service call.
A solution is to use a VBScript function which will handle these errors gracefully. In the example, the function will return a space character if either of the characters are not found. but this can be changed to anything, e.g. “Error”, “String not Found” etc within the function
Using the function is very simple. The screenshot below shows example code:
In the example, the variable Result1 will be set to “This is a test”, whereas Result2 is not found, so is set to a space character.
Full download of the example is available below:
Select String Between Characters Example Script and Task