FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
06-12-2024 09:46 AM
Hi,
I have a HMI project in WinStudio and I would like to use Recipes. The base is working well, I can save data into the recipe, and I can display a list of the saved recipes, but I can't delet in the right way..
Basically I store about 50 parameters in the recipe file (.DAT), and save the list of the reciepes in a txt file, to display and save the list I use Grids and probably this is the main problem what I can't solve. The grid save the txt with comma delimiters and to indicate the end of line it place two comma at the end of the row. When i try to delet the data, this two comma stay in the file and ruin my list.
In the list I store 4 strign variable for each recipes (ID, name, user, comment), this happening in the following way:
$InsertedValues=$ID & "," & $name & "," & $user & "," & $comment
The InsertedValuse string is the input of the grid, which saves the txt file, and an the other grid read this txt.
My problem is that I can not delet the full line of the txt, I can only make the variables "empty" and insert in to the selected row.
Is there any way to delete a line from the txt file ? Can you suggest any other way, make my recipe list working?
Thank you in advance!
Solved! Go to Solution.
06-14-2024 09:48 AM
06-14-2024 11:28 AM
The target OS is Windows 11.
I add the new entries into the file with the features of the grid.
06-17-2024 09:55 AM - edited 06-17-2024 09:56 AM
To use a grid (table) as file open box, do the following steps:
Use the grid to display the csv file with read only mode
To avoid access problems (=file could not be written, when it is displayed in the grid) activate option “Read only”
Use file handling to edit the csv file (add and remove a row)
You can use WinStudio functions or VB script functions to read and write the csv file.
To add a row append it to the end of the file.
You must ensure, that the filed separator, which you have defined for the CSV file is not used in any variable you save to the CSV file.
To delete a row: