Page 1 of 1

read Excel every second for changes

Posted: Thursday 24 April, 2014 - 16:07
by Rens
Hi all,

I have a question about my project, I want to read my excel file every second or by a push message. But I don't know what I need to enter in the red marked field (see attachment).

What is the 4DS syntax for every second?

Rens

Re: read Excel every second for changes

Posted: Thursday 24 April, 2014 - 16:10
by Rens

Re: read Excel every second for changes

Posted: Friday 25 April, 2014 - 10:03
by Nick
Hi Rens,

Could you please explain me a little more about your model / approach. I don't know whether it is a good idea to update your model data every second from excel.

Regards, Nick

Re: read Excel every second for changes

Posted: Friday 25 April, 2014 - 11:47
by Rens
Hi,

Thanks for your interest and reaction,

I use my ED in combination with Microsoft Visual Studio. Visual Studio is my user interface, so you can change some objects or product flows in the model.

I have a production of goods some buffers and packing machines. My goal is to find out if one big packers is better than more smaller packers. So I can select in Visual Studio which packer I want to use and what his capacity is (products/hour).

I can not set up a direct connection between Visual Studio and ED, therefor I use 'database' in Excel. I put my settings in the database and want to read them in ED. Now I have a connection but ED reads my Excel only on resets, now I want to receive data every second or if there are changes in Excel.

Best Regard,

Rens

Re: read Excel every second for changes

Posted: Wednesday 30 April, 2014 - 11:30
by Nick
Hi Rens,

You can use the User Events atom to create a function (User Event) which executes the function 'ExcelActiveX_Read()' at specified intervals, i.e. every 1 second. Refer to this user event function in the capacity field of the buffer/packer atoms.

Regards, Nick

Re: read Excel every second for changes

Posted: Wednesday 14 May, 2014 - 10:32
by Rens
Hi Nick,

In the HELP I can not find information over 'ExcelActiveX_Read()'. Do you know where I can find this information over this function. E.g. parameters.

I want to update every second my excel table, with the red marked button in the Annex I reach this. But how can i do this by 4d Script?

Rens

Re: read Excel every second for changes

Posted: Wednesday 14 May, 2014 - 14:39
by SimonvdW
Hi Rens,

Attached the example model (incl. Excel file) for the ExcelActiveX atom with some minor modifications to read the Excel file every x seconds.
I added a User Event atom which defines a function that calls the Excel file every minute (you can change that to 1 second if you want). If you alter a value in the Excel inbetween (for example the Queue dimension) you will see that after the next call, the capacity attribute is changed.

Regards,
Simon