Rob Posted June 18, 2021 Share Posted June 18, 2021 I am working on a "Lookup" table for converting a numerical value, into a string value for displaying a interpreted machine state. For some reason, I cannot read the string using the File.ReadDelim function, with the [string] variable set to "1" private statemodefile = file.open("XXXXXXXXX_STATE_LIST.csv",1,0,0,1) global lookup_statemode = File.ReadDelim(statemodefile,0,",",chr(10),-1,1) file.close(statemodefile) Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted June 18, 2021 Share Posted June 18, 2021 One problem is that your global variable for storing the result is not a string, so the string data you are pulling in is being converted to numbers, probably a bunch of NaN's. Otherwise I'll need more detail as to what exactly is happening. Quote Link to comment Share on other sites More sharing options...
Rob Posted June 18, 2021 Author Share Posted June 18, 2021 So, I updated the global to a "string" and I am still getting the NaN's private statemodefile = file.open("41000063_50_STATE_LIST.csv",1,0,0,1) global string lookup_statemode = File.ReadDelim(statemodefile,-1,",",chr(10),0,1) file.close(statemodefile) I am reading a standard .csv file 0,Not Ready - Stopped - NONE 1,Not Ready - Stopped - WRN - WRN 2,Not Ready - Stopped - AL2 - AL2 3,Not Ready - Stopped - AL2/WRN - AL2/WRN 4,Not Ready - Stopped - AL1 5,Not Ready - Stopped - AL1/WRN 6,Not Ready - Stopped - AL1/AL2 7,Not Ready - Stopped - AL1/AL2/WRN Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted June 18, 2021 Share Posted June 18, 2021 That is because once a global is declared, it can't be redeclared, so you either need to: 1) use a different name 2) use clearglobals() to eliminate all globals and start over 3) save, close and restart your app Quote Link to comment Share on other sites More sharing options...
Rob Posted June 18, 2021 Author Share Posted June 18, 2021 Thank you I restarted the app, and it did begin to load correctly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.