Download EBD

Hi,

a client has requested to be able to access the Ewon ViewOn page and download the history stored on the ewon , selecting the time period, that will be of 3 days, 1 week etc, and clickin on a button.

I have set up the tags that I will use to get the time period selected and then generate the EBD file but i don’t understand how to download that file.

I’ m trying to use the PUTHTTP command but I don’t see how to use it to download the file on the local machine, is it possible and how do I do it?

Thanks

pegu

Hi @danieleIMode,

Here’s an example I made

image

Each one of those boxes with numbers on them are text field objects. Each one of these text field objects will have a unit id seen below:

You’ll need to match up those unit id’s so that they’ll correspond with the day/month/year like the code that’s attached to the button shows below:

Make sure that for the url, it matches what your ewon’s IP address is.

Other than that you should be able to just run this code and then try it out over eCatcher.

download_from_viewon.txt (701 Bytes)

2 Likes

Thanks @Tim_hms , your solution it’s great.
Just out of curiosity, is there any way to download a file onto a local machine with a BASIC script?
Best regards

pegu

Hi @danieleIMode,

Sorry, I didn’t notice that you replied after that first one. Do you mean that you want the Ewon to be able to push the file directly to your PC without using Viewon?

Yes, a way to download a file using a BASIC function. Thanks

If you can write to your computer using an FTP server then you might be interested in this method:

// Post a file with the Historical logging of Temperature tag
// on a defined FTPserver.
a$ = “/ewon1/Temperature.txt”
b$ = “[dtHL$ftT$tnTemperature]”
c$ = “user:pwd@FTPserver.com
PUTFTPa$, b$, c$

I saw that this was one of the examples in the programming reference guide.

You might also be interested in this method I have that goes over emailing the files to people

Sending Emails with a Flexy.docx (433.3 KB)

This is what i am looking for.

Thanks tim

Hi Tim,
Is it possible to add hour minutes for the same code?

See the Export Block Descriptor Reference Guide.

I’m not sure exactly what you’re trying to do, but Chapter 2 goes over how to set dates and times.

Hi kyle, My question explained in the PPT. Kindly guide me to modify the code for question 2

ViewOn Question.pptx (104.4 KB)

Hello @Santhoshkumar ,

The form is being used to build a EBD, Export Block Descriptor. What fields you can add are limited by the EBD capabilities. For historic logging you can set a absolute time with the format $stDDMMYYYY[[_HHMMSS][[_mmm][[_I][[_T]]]]] where SS is seconds. So you can add an additional field to add minutes to the viewon page. You will also need to update the EBD to include the seconds. See section 2.3.2 for more details on the Absolute time descriptor.

We do not have any data picker box build into Viewon at this time. Viewon does give you the ability to add your own custom Javascript. If you are capable enough you could add a custom date picker.

Thanks deryck for updates.

I am not familiar with viewon script and java script.But i have used above report generation code limited to day month and year its working well.

You can see in this image the key components being made, The variables are pulling from the text boxes and creating the ebd in date variable. You will need to replace the “_000000” with additional variables using additional text boxes and getelementbyid. You would need to add one to two variables to add the HHMMSS

$stDDMMYYYY[[_HHMMSS][[_mmm][[_I][[_T]]]]

hi deryck,
Am trying to write Custom JavaScript to get datetime from viewon inbuilt datetime picker by classname to generate ebd report. During simulation in the URL, Date and time is “undefined”

these are screenshots



datetimepicker

Can u help me on this…

Hello @Santhoshkumar ,

This falls outside of out typical free support. @hugh_hms has done some work similar to this he may have some suggestions or might be able to take a deeper dive with you as a service.

1 Like

Hi @Santhoshkumar,

getElementsByClassname returns an array of elements that match the classes specified, even if there’s only one that matches. Instead of checking .value on the returned array, you’ll need to point to the first item in that array and then check .value.

var sdate = document.getElementsByClassName("dateStartInput dateInput ui-widget-content ui-corner-all")[0].value;

Note the [0] immediately after the function call.

1 Like

Thank you hugh and deryck,

  Its working now....