In reply to: Daniel Krüger (Cosmo Consult)
executing a SQL statement with declare doesn't work in the Designer studio, but it does work anyway.
But you don't need it in this case, you can return the WFD_Description from a query inside the dbo.SplitToTable()
At least if you want to do it for a single workflow.
( select Top 1 WFD_Description from WFElements where WFD_Description is not null),',')
If you have multiple workflows you could use
select Top 100 WFD_ID, Comments.*
from WFElements cross apply dbo.SplitToTable(WFD_Description,',') as Comments
where WFD_Description is not null
I finally managed to make it work.
I actually found out that the process I used for testing was not using the JSON format for comments, but the actual production process was using the JSON format, so I actually ended up using the sql for JSON in production. Apparently, the format of comments isn't based on classic/modern forms, but the Webcon version the process was made in.
Even so, when I wanted to make it dynamic, so the process would read comments from the current instance, I couldn't simply add a WHERE WFD_ID = Instance ID, as this generated an error, probably because of all the replace statements. I defined a variable at the beginning of the query which I used for saving the current instance ID and then used the variable in the WHERE clause. This is annoying even though it works in production, since Webcon Designer Studio throws errors because of the variables. You need to save the configuration without variables and then add the variables and save it again. It's really clumsy.
Webcon should really improve on this. Using variables should work in Designer Studio. And adding comments to output should be easier, I don't think this is such a niche requirement.
Thanks for your help Daniel, really appreciate it!