Rodney Posted July 9, 2017 Share Posted July 9, 2017 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 Link to comment Share on other sites More sharing options...
AzeoTech Posted July 10, 2017 Share Posted July 10, 2017 You can't access datain from the command/alert because you made it private. Private variables are only visible within the sequence they are declared in. Make it global instead, at least for testing. Link to comment Share on other sites More sharing options...
Rodney Posted July 10, 2017 Author Share Posted July 10, 2017 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 Link to comment Share on other sites More sharing options...
AzeoTech Posted July 10, 2017 Share Posted July 10, 2017 Sorry, your screenshot didn't post properly. Link to comment Share on other sites More sharing options...
Rodney Posted July 10, 2017 Author Share Posted July 10, 2017 i have reattached see below Link to comment Share on other sites More sharing options...
AzeoTech Posted July 10, 2017 Share Posted July 10, 2017 Don't put spaces between your symbols and the [], or for that matter the function name and the () Try adding ? before line 6: ? datain[site_ID][0] and also try: ? evaluate(datain[side_ID][0]) Link to comment Share on other sites More sharing options...
Rodney Posted July 12, 2017 Author Share Posted July 12, 2017 Thanks - after testing a number of syntax versions this finally worked component._TestStr.strText = datain [site_ID[0]][7] Link to comment Share on other sites More sharing options...
Rodney Posted July 15, 2017 Author Share Posted July 15, 2017 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 More sharing options...
AzeoTech Posted July 21, 2017 Share Posted July 21, 2017 As I said before, don't put spaces between your symbol names and the [ or (. Once you remove the space in your assignment line, it works fine. Link to comment Share on other sites More sharing options...
Rodney Posted July 24, 2017 Author Share Posted July 24, 2017 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 Link to comment Share on other sites More sharing options...
AzeoTech Posted July 26, 2017 Share Posted July 26, 2017 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.