import .csv file into 2 dimensional string array


Recommended Posts

I am trying to open a .csv file in DAQFactory so I can update a number of string fields it contains and then update any changes back to the file

I've been looking at the forum and the manual and cannot even get the file open / read to work (well I don't think its working)

? datain returns an error - how can I see If I have loaded  a 2 dimensional string array "datain" with data?

I have attached my sequence, sample Excel .csv file and notepad (txt) version of the file

Basically I want to be able to update say cell D6 in the excel.csv with user string input using the set to action (if I have the array correct I think its variable datain {5,4})

 

 

 

 

 

 

parameters.csv

parameters.txt

File_Import.PNG

Link to comment
Share on other sites

Thanks for that - works now!!

now I can do that I have a syntax problem

in line 5 if I hard code the Datain element I wish to display {3,0}  - it works

however I would like it to be dynamic based on the Site_ID (which is updated via combo box on a page) - see  commented out line 6 - it doesn't work

I used evaluate in testing just to see if line 5 would work with it and without it - it does

what is the correct syntax?

Rodney

 

Syntax_error.PNG

Link to comment
Share on other sites

Hi

I have another simple syntax problem

I am trying to update an element in the array Datain (2 Dimensional string array) using the following line of code

datain [site_ID[0]][8] = datadesc1[0]

I read the initial value from a file - that works

?  datain [site_ID[0]][8] returns "hawker gate" which is from the CSV file and correct

? datadesc1 [0] returns "DummyString" - the data I have entered into the variable via a page component

in my testing datain [site_ID[0]][8] = "teststring" works

after running the test sequence with the above line of code I was hoping the element would be updated with "DummyString" - its not....

i assume I must somehow convert datadesc1 [0] into some kind of string (even though I think it already is)

Your wisdom greatly appreciated!!

Regards

Rodney

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

Thanks - that works

now I have another syntax? problem

I am trying to use the OnChange Event to run a simple sequence once the operator changes data in an edit box

I have read the manual but its not clear to me what I have to do

see attached

The Text Component is named Description04 and currently contains "Gums 44 Data northeastsouth"

When the operater clicks on it an edit box allows him to change the text - I would like to run the sequence "Location" whenever the text is changed via the edit box

the sequence just updates the display using component.description4.strText

I can run the sequence "Location" manually and it works - I just cannot get it to run using the OnChange event

Obviously my lack of programming is the issue - what do I need to do to get "location" to run whenever the text is changed via the edit box?

Regards

Rodney

 

 

 

 

 

 

ONChange.PNG

Link to comment
Share on other sites

To call a sequence as a function you need to add (), otherwise it doesn't know its a function:

location()

Note that if the sequence Location is as simple as you say and not reused elsewhere, you might as well just put the script from the sequence directly in the event.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.