LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use prompt message to add new data to spreadsheet file

Solved!
Go to solution

I have built a small search engine over a spreadsheet file that represents a virtual library. The initial data is filtered to an 2D as illustrated in (figure 1). If by chance I am searching for a book that's missing in the data set, it is used a prompt message subvi that gives freedom to create a new entry for the data set, in this case a new book (figure 2).

The original csv/txt file is changed in this part of the program. My issue is that althought this new book appears in a good fashion at the end of the file (figure 3), it is not recognized by the search engine itself (that's the meaning of the message appearing in the last picture in portuguese).

I tried already several ways to convert data from the bundled prompt message to the write to spreadsheet function, with no success. Figure 4 shows the kind of techiques I am trying to apply, form a direct prompt message-> build array-> write to spreadsheet toiInserting formating data functions, this case str to byte and byte to str, and using array to spreadsheet string and spreadsheet string to array.

believe it has something to do with this prompt message function, but also I may be overlooking something fundamental about data formating between different softwares. Any insight into this issue welcome, and thank you for your time!

0 Kudos
Message 1 of 10
(2,359 Views)

Hi ribxni,

 


@ribxni wrote:

I tried already several ways to convert data from the bundled prompt message to the write to spreadsheet function, with no success. Figure 4 shows the kind of techiques I am trying to apply, form a direct prompt message-> build array-> write to spreadsheet toiInserting formating data functions, this case str to byte and byte to str, and using array to spreadsheet string and spreadsheet string to array.
believe it has something to do with this prompt message function,


Why do think it's a problem of that Prompt ExpressVI when you do all this Rube-Goldberg stuff to create a string array and write it to a file? Do you even append the data to your spreadsheet file or do you just transpose the array?

And why do we just get images when you need help with your VI? (When you don't attach the real VI then you should use AutoCleanup at least…)

 


@ribxni wrote:

My issue is that althought this new book appears in a good fashion at the end of the file (figure 3), it is not recognized by the search engine itself (that's the meaning of the message appearing in the last picture in portuguese).


Then the problem maybe is in this "search engine": again I need to ask for the real code instead of some images showing mainly frontpanels…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(2,308 Views)

First, I enjoyed your Rube-Goldberg joke 🙂 I'll search into this guy.
Secondly, it's auto-cleaned already 😉

But to simplify, if i connect the prompt message directly to a build array function and then to a write to spreadsheet function (fig. 1) I got the same result (fig 2) as in the previous code.

I believe this may be a issue because I can change the quantities in the last column during the query to the data base- I remind you this table is converted into a 2D array of strings- and the last column is converted to numeric array and then again to a string array that substitutes the last column in the original 2d array and I have no problems.

What happens mostly is that this two added lines in figure 2 will appear like strings bounded by "": for example a line with "I wish" "to" "reuse this entry" and when I use a Search In Array function for the element - for example I wish- it will not be reckognizable.

So the string that is outputed in the prompt message is written in the .csv file but afterward it's read by Labview as a bounded string (sort to say).

 

Thank you for your response GerdW

0 Kudos
Message 3 of 10
(2,289 Views)

Hi ribxni,

 


@ribxni wrote:

First, I enjoyed your Rube-Goldberg joke 🙂 I'll search into this guy.
😉


There is a Rube-Goldberg thread in the Breakpoint section of this forum. You really should read it…

 

After writing all that text in your messages: mind to attach your VI(s) and some sample csv file?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(2,281 Views)

Ok if you insist x) you use the interface in the frontal panel to load the csv file (the one I've used in this thread) which builds an (A)i,j matrix with indexes j (search type selector) and i (searching field). This is a school project so it's in portuguese, but you get the point. If you try and change the quantities of each element it is working all right, only the new entries do not function within this system (search and sort). If you check the hierarquy tree looks to me something is missing when creating a new entry to the data base, but i believe it has something to do with the type of data that is genereated by this message prompt. My idea is to develop further this system with image acquisition and automate this system using my webcam. Regards!

Download All
0 Kudos
Message 5 of 10
(2,269 Views)
Solution
Accepted by topic author ribxni

Hi ribxni,

 

more Rube-Goldberg:

What's the point in converting a 2D array into an array of clusters, when you convert it back into a 2D array???

Don't you trust autoindexing in FOR loops so you needed an additional ArraySize function?

 

The Prompt ExpressVI code after a little code cleanup:

No need to convert strings into U8 arrays, just to convert back to strings! (Rube-Goldberg!)

No need to convert string array to spreadsheet string, just to convert back to string array! (Rube-Goldberg!)

Most important: You almost always should make the display style indicator visible for string constants. That "\" indicates I selected the "\-code display style". Your delimiter at the WriteSpreadsheetFile contains an additional TAB char: is this intended or accidental?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Download All
Message 6 of 10
(2,266 Views)

How did I miss that tab for a week?!? 😃

So I've changed the delimiter as you suggested with no good result (fig 1.). Then I've exchanged the order of it to - ;/t - and it was possible to find the book by the title, but the rest of the columns had an extra /t in the entries. So yes, I confess, carefully deleting the extra tab and now is working! (fig 2.) Thank you!

All the u8 to string junctions and array functions were there to show the king of approaches I've used to solve this issue, as explained before.

The cluster converter was a way to create a virtual library in the begining of this project and to create a model for a reference for every book. If I create an indicator in the first for loop I can separate every book in different entities. Also this concept began with a boolean array that stated which books were in the shelf (this were manually selected on the frontal panel). I can create it on the second for loop also, it's just a question of keeping track of the changes in the project.

An extra question, I've downloaded de IMAQ library for vision acquisition, my idea was to detect the ISBN throught the bar code of this books and compare with my data set.

I noticed a vision machine library on the NI-IMAQ collection in some tutorials on Youtube, but it is not available for in the trial version I am currently using. There is any way to install this Vision Machine group of functions or is it blocked for experimental users? Thanks again for your time and sharp eye!

Download All
0 Kudos
Message 7 of 10
(2,236 Views)

Just updating the 2nd picture.

0 Kudos
Message 8 of 10
(2,243 Views)

Hi ribxni,

 


@ribxni wrote:

An extra question, I've downloaded de IMAQ library for vision acquisition, my idea was to detect the ISBN throught the bar code of this books and compare with my data set.
I noticed a vision machine library on the NI-IMAQ collection in some tutorials on Youtube, but it is not available for in the trial version I am currently using. There is any way to install this Vision Machine group of functions or is it blocked for experimental users? Thanks again for your time and sharp eye!


So you are using a trial LabVIEW version and now you want to use a trial version of the (expensive) ImageAcquisition module too? When you cannot install/acivate this module you may call your local NI sales department for assistance…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(2,202 Views)

Thank you

0 Kudos
Message 10 of 10
(2,174 Views)