Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


SimonM
2017-11-09T15:13:22Z
Hi All,

I am new to visual cron and trying to generate an email containing output from an sql but as a table.
Are you able to tell me how this is possible?

I have tried to put the out put to an excel file and then using a read variable to put it in the body of the email.
I have tried using a text file, this has almost work but the formatting is all over the place and not suitable if there is a way the text file could be formatted this may work.
I have tried to output to html and then read it but this still hasn't work it displays all the data on one line.

any advice would be appreciated.

Simon
Sponsor
Forum information
Gary_W
2017-11-09T18:12:40Z
Please mock up an example of what the expected output should look like and attach a pic.
thomas
2017-11-11T14:02:12Z
From my attempts, it is hard to get it right without sending the output through some .net code to make it email friendly. I couldn't do it with VC tasks alone.
Therefore I have created a C# class where you pass in these 3 parameters:

The sql output from the previous task (or any other task): {TASK(PrevTask,StdOut)}
The title line for your table eg: Name;City
The separator used in title and data, eg semicolon: ;

The class then returns a table that looks pretty decent in outlook at least. You then pass this result to a email job where you have checked 'send as html'. It is a bit of work to set up, and you have to call a .net assembly. Once it is done however, you can use it all over the place and it saves you work in the future. If you are interested, I can give you the code I have.



SimonM
2017-11-13T09:29:43Z
Originally Posted by: Gary_W 

Please mock up an example of what the expected output should look like and attach a pic.




HI,

below is ideally what i would like with in the email body.

mocked up table.JPG

the SQL output is as follows:

Courier.JPG

thanks Simon
SimonM
2017-11-13T09:31:37Z
Originally Posted by: thomas 

From my attempts, it is hard to get it right without sending the output through some .net code to make it email friendly. I couldn't do it with VC tasks alone.
Therefore I have created a C# class where you pass in these 3 parameters:

The sql output from the previous task (or any other task): {TASK(PrevTask,StdOut)}
The title line for your table eg: Name;City
The separator used in title and data, eg semicolon: ;

The class then returns a table that looks pretty decent in outlook at least. You then pass this result to a email job where you have checked 'send as html'. It is a bit of work to set up, and you have to call a .net assembly. Once it is done however, you can use it all over the place and it saves you work in the future. If you are interested, I can give you the code I have.



Hi Thomas,

if you could i would really appreciate that
I dont mind giving it ago
thank you

Regards,

Simon
al355
2017-11-13T09:55:28Z
We do this using a format function in SQL, convertTableToHTML (an online search should find it)
thomas
2017-11-13T10:35:14Z
Al's suggestion sounds much simpler than mine. You should probably check that one first
Scroll to Top