From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Editing multi column .csv

Solved!
Go to solution

Has anyone had any luck editing a multi column .csv? 

 

I can edit multiple .csv's with one column each. 

 

The attached is an example of that. 

 

When I could get it to edit multiple columns, I would delete one thing from one row and it would delete the entire row. 

 

Basically this .vi will be to add permissions to people on test equipment during my login .vi.

 

I know I could just edit the .csv, but when I add a new user, I don't want them to have the ability to see everyone else passwords while they enter their own.

0 Kudos
Message 1 of 6
(1,008 Views)
Solution
Accepted by NoobGee

Hi Noob,

 


@NoobGee wrote:

When I could get it to edit multiple columns, I would delete one thing from one row and it would delete the entire row. 


Because you programmed it to delete the complete row. What else do you expect?

When you don't want to delete the whole row, but only edit/replace the content of some elements then you should use ReplaceArrayElement instead of DeleteFromArray!

 


@NoobGee wrote:

I know I could just edit the .csv, but when I add a new user, I don't want them to have the ability to see everyone else passwords while they enter their own.


So you think your users will not find those CSV files and they will not be able to read/edit them on their own?

You better think about using more advanced techniques when you "don't want them to have the ability to see everyone else passwords"!

 

What's the point of an autoindexing FOR loop that just wires from input tunnel to output tunnel???

Why is the "Edit" control a ring and not an enum?

Best regards,
GerdW


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

Thank you @GerdW.

 

I'm not worried about them finding the .csv's. If it becomes a problem, then I do need to find a more advanced solution. I am most definitely open to ideas! 

 

It's more for report generation. Them logging in to the test program will just add a digital signature, so we can track who tested what.  

 

The auto indexing of the For loop was just a simple and smooth way for someone to choose what they wanted to delete, from a dropdown. 

 

As far as the control ring. It could've been either-or. It is a subvi, so it it is just running in the background.

 

Thank you for your quick response!

0 Kudos
Message 3 of 6
(975 Views)

Hi Noob,

 


@NoobGee wrote:

As far as the control ring. It could've been either-or. It is a subvi, so it it is just running in the background.


What has the datatype of that control to do with how you run that VI?

Even when it is running in background: when using an enum that case structure becomes self-documenting (when using good enum item labels) and less error-prone (as there is no need for default cases anymore), so it's a question of proper code design!

Best regards,
GerdW


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

Hi GerdW,

 

Thank you so much for that info.

 

I have been learning everything on my own for the past year, so I honestly didn't think of it like that. 

 

I know when I pull the data from the .csv's, I use a ring. say that users 1-20 get all access (even if they are empty cells, in case I have to add someone) and 21-99 get restricted access. Does that make sense to you, or is there another way you would go about it?

 

Just an FYI I'm still open to ideas on creating a more advanced solution to a login! I have searched the forums for ideas, but I have not came across any that pop out like that.

0 Kudos
Message 5 of 6
(936 Views)

Hi Noob,

 


@NoobGee wrote:

I know when I pull the data from the .csv's, I use a ring. say that users 1-20 get all access (even if they are empty cells, in case I have to add someone) and 21-99 get restricted access. Does that make sense to you, or is there another way you would go about it?


That ring control is set to show items of "Edit", "User", Password" and the case structure has 3 cases of "0, defaut", "1" and "2". Using an enum of items "Edit/User/Password" would give you a case structure with exactly those 3 cases, with added code readability and documentation. Do you really remember what case "1" was supposed to do in 6 month or 2 years?

I don't know how that ring/enum suggestion is related to how many users (and permissions) you want to handle!?

 


@NoobGee wrote:

Just an FYI I'm still open to ideas on creating a more advanced solution to a login! I have searched the forums for ideas, but I have not came across any that pop out like that.


General advice: never save passwords in readable text.

You might encrypt the passwords or even store only hashes instead of the real password.

 

You might also use Windows functions to check users by their (domain) username and password. (Look at MSDN for "UserCredentials"...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(902 Views)