Switch to desktop version  
ExeSSI works in the template but not in the emailed copy - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Custom Web Pages/viewON/Talk2M Visualization (https://techforum.ewon.biz/forum-55.html)
+--- Thread: ExeSSI works in the template but not in the emailed copy (/thread-1325.html)



ExeSSI works in the template but not in the emailed copy - ablooabloo - 19-05-2020

Hi,

I'm trying to generate reports with a dynamic data range, the goal being to display relevant data for only one "round" of production. To this end, I have a script in the eWon BASIC IDE to generate an EBD, which is then read by the .shtm page in order to get the data. A report is then emailed at completion.

The template itself seems to work if I load it directly from the eWon, but the ExeSSI blocks seem to run into some kind of a problem when I view the email attachment. They don't seem to get the data I need.

I've tried to run a sample snippet of code (reading a tag description) as well and the same thing happens. If I go through the eWon and load the .shtm directly the code works, but if I try to have it sent by email then it doesn't seem to get executed correctly.

I also run TagSSI commands in the .shtm which work.

ExeSSI block :

Code:
<%#ExeSSI,
SETSYS TAG,"load","Temp306_EBD"
ebd1$ = GETSYS TAG,"TagValue"
OPEN ebd1$ FOR TEXT INPUT AS 1
readLoop1:
a1$ = Get 1
PRINT #0,a1$;
IF a1$ <> "" THEN GOTO readLoop1
CLOSE 1%>

BASIC script to generate the EBDs :
 
Code:
Temp306_EBD@ = "exp:$dtHL $ftT $st" + Jours$ + Moiss$ + Annees$ + "_" + Hdcs$ + Mdcs$ + Sdcs$ + " $et" + Jours$ + Moiss$ + Annees$ + "_" + Hfcs$ + Mfcs$ + Sfcs$ + " $tnTemperature_306"
Pres306_EBD@ = "exp:$dtHL $ftT $st" + Jours$ + Moiss$ + Annees$ + "_" + Hdcs$ + Mdcs$ + Sdcs$ + " $et" + Jours$ + Moiss$ + Annees$ + "_" + Hfcs$ + Mfcs$ + Sfcs$ + " $tnPression_306"
CTemp306_EBD@ = "exp:$dtHL $ftT $st" + Jours$ + Moiss$ + Annees$ + "_" + Hdcs$ + Mdcs$ + Sdcs$ + " $et" + Jours$ + Moiss$ + Annees$ + "_" + Hfcs$ + Mfcs$ + Sfcs$ + " $tnSetpoint_Temperature_306"
CPres306_EBD@ = "exp:$dtHL $ftT $st" + Jours$ + Moiss$ + Annees$ + "_" + Hdcs$ + Mdcs$ + Sdcs$ + " $et" + Jours$ + Moiss$ + Annees$ + "_" + Hfcs$ + Mfcs$ + Sfcs$ + " $tnSetpoint_Pression_306"


Sample EBD :

Code:
exp:$dtHL $ftT $st19052020_121047 $et19052020_122011 $tnTemperature_306

Thanks for any help.


RE: ExeSSI works in the template but not in the emailed copy - simon - 22-05-2020

Hi,

To my point of view, the problem is caused by the command PRINT #0,a1$;
which only works to output data into the web browser.
When I use in the email sending as you do, I get the error : east-Invalid Parser name in InitSSI
Do you get the same ?

To me, the best option to keep you EBD String Tags is to handle your alarm notification by script (ONALARM command).
You can then send an email using SENDMAIL containing the custom EBD you want to use (according to the Tag that has fired the ONALARM).

Simon


RE: ExeSSI works in the template but not in the emailed copy - ablooabloo - 12-06-2020

(22-05-2020, 04:49 PM)simon Wrote: Hi,

To my point of view, the problem is caused by the command PRINT #0,a1$;
which only works to output data into the web browser.
When I use in the email sending as you do, I get the error : east-Invalid Parser name in InitSSI
Do you get the same ?

To me, the best option to keep you EBD String Tags is to handle your alarm notification by script (ONALARM command).
You can then send an email using SENDMAIL containing the custom EBD you want to use (according to the Tag that has fired the ONALARM).

Simon

Hi,


Sorry for the late reply, I was out of the country for work.

I do get that error when I send the file as an email attachment. That being said, this error does *not* happen when I open the file directly from the eWon (by that I mean by entering my eWon's IP address/usr/filename.shtm). When I do that, it works as expected. The ExeSSI blocks only fail when the file is sent as an email attachment.

I have tried another method to populate my attached email webpage with the necessary data to load the graphs, by using Web-content variables. I first call an ExeSSI block to get the EBD from the eWon :


Code:
<%#ExeSSI,
SETSYS TAG,"load","Temp305_EBD"
ebdtemp! = GETSYS TAG,"TagValue"
SETSYS TAG,"load","CTemp305_EBD"
ebdtempc! = GETSYS TAG,"TagValue"
SETSYS TAG,"load","Pres305_EBD"
ebdpres! = GETSYS TAG,"TagValue"
SETSYS TAG,"load","CPres305_EBD"
ebdpresc! = GETSYS TAG,"TagValue"%>

Then I simply use a ParamSSI tag that refers to the variable containing the EBD :


Code:
<%#ParamSSI,+ebdtemp%>

This, again, works perfectly when the .shtm page is accessed directly in the eWon, but it does not work at all if the same page is sent as an email attachment.

I have two reasons for trying to do it this way. First, I need to access dynamic/shifting chunks of logged data. This means a custom EBD has to be generated in the BASIC scripting of the eWon before the report is sent, so I have to find a way to get it from the BASIC variable and execute it on the webpage. Second, I know that the eWon can generate historical logging data in the form of graphs, but only for one tag per graph. I need to have multiple tags charted in a single chart, so I'm using a custom webpage with a JavaScript applet to generate the chart. Everything else works, I just need to populate the webpage with data on an absolute time span.

I have tried everything I can think of without success as everything I attempt calls for the use of an ExeSSI block which seems to fail in the attachment. Granted, I have little experience with eWons so if you can think of something I'd be really grateful.

EDIT : I still don't know what the problem is, however I have bypassed it by populating the .shtm using a ParamSSI instruction with a large relative time span, passing a UTC start/end date string built from the BASIC IDE, converting it to a Unix timestamp in Javascript and modifying my script to reject any data not located between those two timestamps before building the chart. It seems to work well, fingers crossed.