10-29-2015 04:05 PM
Hi everyone thanks in advance for your time .
I'm almost finishing a project , (a software to handle hotel room reservation and a data base of passengers ) .
I made a function which writes to a .txt file a cluster with a few string fields of personal informacion , each field separated by tabs and each client separated by new line .
Example : name address phone etc.
Robert xxxxxx yyyyyyy
Patrick xxxxxx yyyyyyy
Mila xxxxxx yyyyyyy
Now i don't know how can i do to search by name and to be able to modify each field .
Example :
if i search for Patrick , i want to be able to modify the address or phone number , or any other field .
I know how to search in a text file until i reach the word searched , but i don't figure out how to modify the field and write again the information to the same file in the same original line .
Any contribution will be great ! thanks again .
Solved! Go to Solution.
10-29-2015 04:11 PM
Sounds like you may want to consider using a real database instead of a text file at some point.
For now, look into Search and Replace using Regular Expressions.
10-29-2015 04:21 PM
Can you post at least the cluster control you are using, if not the VIs as well?
10-29-2015 04:26 PM
10-29-2015 04:48 PM
thank you all for helping me .
Here it is what i'm trying to do .
10-29-2015 04:48 PM
Yep, doing a Read from Spreadsheet (or, in 2015, Read Delimited Spreadsheet) makes it relatively simple. Row 1 has all the Headers, so you can find the Column headed "Name" by doing a search. You can now search the Name Column looking for whomever, which gives you the Entry Row. Finally, read the Row and do what you will.
Bob Schor
10-29-2015 05:02 PM
thank you friend .
yes i don't have problems with search the line to modify , i have trouble with modify the field and then save the array to the original file , in a few words ,
i read the complete file and i get an array of strings , then i transform each element of that array into another array which contains each field of the desired line , now i perform the modifications to the fields , but then i have to save the modifications to the original file , (update the original file ) , i hope you could understand .
Thank you .
10-29-2015 05:04 PM
Hi Maxi,
I think they are saying that if you use "read from spreadsheet" you will get a 2D array. You can easily replace your array element, then write to spreadsheet again. In this context a "spreadsheet" is just a delimited text file, it looks like you chose tabs so it should work quite nicely.
In short, don't use the read from text file, use the read from spreadsheet.
10-29-2015 05:13 PM
thanks for your clear explanation , i did not understand sorry , i will try what you said .
Thank you very much , and thanks to all of you for always help !
10-29-2015 05:50 PM
Sorry about being so dumb , but i can't achive what you suggested .
Here is the block diagram .
Thanks again for your kindness