TylerHPS Posted February 5, 2018 Report Share Posted February 5, 2018 What the main goal is: To download a CSV file from an external source and then transfer that data into an array which will be used throughout the program. I assumed my first step was to convert a CSV file to a udtf file and then use the function "Copy column to array". However, when I try and use the CSV to UDTF my status bar always shows "-1", I have a micro SD card in the slot and a USB in another slot with the required CSV file. I also tried just putting the file onto the micro sd card but that also didn't seem to work... Am I using the function properly? Any advice would be helpful as this is my first time using Unitronics Thank you Link to comment Share on other sites More sharing options...
NoamM Posted February 18, 2018 Report Share Posted February 18, 2018 Hi TylerHPS, From checking the Help section I can see that "Convert CSV TO UDTF" status "-1" means that "The .csv name is an empty string or, contains the '/' character". What is your "Source CSV file name" (parameter B of "Convert CSV TO UDTF" Ladder function)? Link to comment Share on other sites More sharing options...
TylerHPS Posted February 20, 2018 Author Report Share Posted February 20, 2018 Turns out the string that I added needed a power up value, the function searches for the power up value of the string and not the actual string name. Maybe add this to the help file! Link to comment Share on other sites More sharing options...
Saragani Posted February 20, 2018 Report Share Posted February 20, 2018 26 minutes ago, TylerHPS said: Turns out the string that I added needed a power up value, the function searches for the power up value of the string and not the actual string name. Maybe add this to the help file! That is not correct. The function takes the current value of the tag. If power up value worked, then it means that your tag originally had no value (it was an empty string). Explanation: When the ladder starts, a small piece of code runs, which is the code that sets the power-up value. For example: MyString = "Hello World"; Now if in another place in the code I do: MyString = "Foo Bar"; then now the tag contains FooBar. Convert CSV to UDTF does not know, and could never know what the power up value was. Tags are placed in memory in an absolute address, so writing a new value (like Foo Bar) overwrites the memory where the string that was set during power up. When calling CSV to UDTF, the pointer (address of the string tag) and its length are being sent to the CSV to UDTF file. Since setting power-up value made it work, then it means that the code that sets the actual string value is never called, else the new value would have been used and not the power up value. (And this also explains why you had an empty string that caused the error status). Link to comment Share on other sites More sharing options...
TylerHPS Posted February 20, 2018 Author Report Share Posted February 20, 2018 Hmm interesting, I will try that out! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now