LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

searching Database, updating and Store new update

Hello everyone,

 

this post is catching up with the previous posts. 

 

I already created a VI called Admin that is able to Add and Delete new clients. 

 

now i'm trying to work on View button, in view button i would love to have a search string to search for the client i want, after i find that user in the database i should press OK to bring me the client file. then I'll check this file, then update it and store the new update in the database again under the same file name. also i want to write a short report about this client and also save it in the same file. 

 

the Admin VI have the permission to see every client, add and delete, after finishing this VI, i'll copy the View as subVI for another user permission (let's call it Anthony) Anthony should only view (update client information and write a report), never add or delete. 

 

after finishing the Admin with all the details, i'll create the same file but for users, the difference will be just few things, as declaring the new user and his/her new security permission as (Admin or Anthony). 

 

what I need in here, is how to do the View button. I need tips to work with it. I never did the search button and also I don't have any database, i'm going to created with adding my new client as i'm saving the new clients in CSV file. so the search should detect the file name, assuming another admin adding new clients. 

 

please check the sketch of my idea. 

 

Black colour is the admin

Green colour should be Anthony (user with lower permission level than admin)

Red colour should be the SubVI for Anthony. 

 

 

 

I'll appreciate any help. 

 

0 Kudos
Message 1 of 7
(3,043 Views)

A few quick questions:

Are the client names unique?

Do you want to be able to match partial strings?

Your description makes it sound like you have a file for each client - how is this file formatted (do you need help with reading the file, or is this question just about searching)?

 


GCentral
0 Kudos
Message 2 of 7
(3,011 Views)

Hi mate, 

 

as you are in my head now. 

 

Are the client names unique?

yes it is unique number and should never duplicate 

 

Do you want to be able to match partial strings?

i don't mind to detect few characters then clicking on the client name and pick it up

 

Your description makes it sound like you have a file for each client - how is this file formatted (do you need help with reading the file, or is this question just about searching)?

i was just thinking about this step. the file should be similar to detailed information with two tabs or sheets in one page, one for the history and the other to update the new information and store it in the history with the old ones. nothing to be removed or deleted. 

assuming you are going to a hospital, your file have the details of your last visit and what did you do there, this kind of information. for example if i go to GP now, he'll say " ah in 2006 you broke your arm" something like that.

 

 

thanks for your help tho. 

0 Kudos
Message 3 of 7
(3,005 Views)

Hi N.Ghrayeb

If you are getting the file values in a matrix, you may generate a 1D array of the names in your file, place a String Control and then use the Search 1D Array function to get the index of the element that matches your input when you press your button.

This function is polymorphic, so it can manage any type of data.

 

Search 1D Array

http://zone.ni.com/reference/en-XX/help/371361J-01/glang/search_1d_array/

 

Regards,

 

Kudos are welcome 😉 marked solutions are awesome!
0 Kudos
Message 4 of 7
(2,974 Views)

N.Ghrayeb wrote: 

now i'm trying to work on View button, in view button i would love to have a search string to search for the client i want, after i find that user in the database i should press OK to bring me the client file. then I'll check this file, then update it and store the new update in the database again under the same file name. also i want to write a short report about this client and also save it in the same file. 

 

...

 

I don't have any database, i'm going to created with adding my new client as i'm saving the new clients in CSV file. so the search should detect the file name, assuming another admin adding new clients 


If you used an SQL database, and probably a whole range of other databases, it might be easier to just query if a record exists given a specific name as a key. Then you can implement logic like "unique" directly in the data store and use either items or a labview flattened dataset stored as a blob as your value.

 

LabVIEW can directly interface with some databases and there are several free libraries (with varying licences) for SQlite, which I've been using quite happily.


GCentral
0 Kudos
Message 5 of 7
(2,963 Views)

Hello HectorBeristain

 

thanks for your reply, i'll give it ago. never knew this function before. 

 

 

 

Thanks 

0 Kudos
Message 6 of 7
(2,954 Views)

Hello cbutcher

 

I haven't work with SQL for ages now. but i'll consider this idea and try it as well. 

 

I'm not sure how easy or hard for me to do it, as my whole experience in LabVIEW comes from those forums. 

we'll see what will happen.

 

 

 

 

 

Regards,

0 Kudos
Message 7 of 7
(2,953 Views)