LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

checking the matching text in the database

hi need help..
I have stnid=SED001,SED002,...
sometimes let say there is no stnid it must store as SED9999/SED9998/...
 
1)
its like this if true i pass the stnid to the database.
if false i must pass SED9999, if the database already have SED9999 it should store SED9999-1,...and so on
 
or i can use this
 
2)
let say the stnid is false ..i create a vi and ask the user to insert a stnid...and check the database the number is already stored or not.
 
which one is better and how to that?
 
plz help
 
 
 
0 Kudos
Message 1 of 15
(3,571 Views)
Hi jeyanthi,
i think the solution depend on what you want to do. Is it an automatic process where you have less as possible user interactions, then i would prefer the first solution. If it is important that stnid correct, nobody has to change it later, then i would prefer the second solution.
Can you explain more about the background?

Mike
0 Kudos
Message 2 of 15
(3,556 Views)
hi mike i'm goin for the second option.
let say the user insert the stnid.
now i have to check the database is the stnid is already stored or not stored.
if stored i must pop up a message tell tht the number is already in use and user have to insert another stnid.
 
 
 
0 Kudos
Message 3 of 15
(3,553 Views)

Hi jeyanthi,

is it a "real" database or a text file? If you have a database you can send an SQL command to it which search for your string. If you have a text file, then you can read in the data, and use for example the match pattern function.

Mike



Message Edited by MikeS81 on 05-20-2008 08:17 AM
0 Kudos
Message 4 of 15
(3,550 Views)
Hi again.. sry to disturb if i use the 1st method without the user not doin anythg wen the data from text file convert to text file...is it can be dono using queries only.
0 Kudos
Message 5 of 15
(3,544 Views)


jeyanthi wrote:
...is it can be dono using queries only.

Hi jeyanthi,
i don´t understand it.
 
If you use the textfile method, you can for example store the last automatic used number. And if you need it you increase it and create the new number. Write the last used number at the end of your program to the file, so that you can read it the next time you start. Another soultion could be to scan the file for the last automatic used number.
 
Mike
0 Kudos
Message 6 of 15
(3,539 Views)
let say i have stnid as unique key in database...how to check tht the station number already inserted to the database.
 
i have attach the text file and the vi. i use
 
in the vi i pass the data to two tables one is stationlogews and stationinfoews.
 
for stationlogews i dont have any problem currently.
 
for stationinfoews it has to stationnumber as unique let say sed001 is inserted it not should insert again the same number..
 
how to do tht?
 
and let say all the data is inserted to the database.. how to stop it from inserting for the second time running..
 
 
Download All
0 Kudos
Message 7 of 15
(3,511 Views)

Hi jeyanthi,

as a first step read your data. Than use the spreadsheet string to array function, you can use ";" as seperator. Delete all empty lines (onyl before and after a text block) and read your specified position where you expect the sed00x entry and create an array of them. Then you can may be sort this array and check if an entry is already there.

Mike

0 Kudos
Message 8 of 15
(3,507 Views)

Hi jeyanthi,

it´s a little bit different as my description, but here is an example, which shows how you can read your sed elements.

Hope it helps.
Mike

0 Kudos
Message 9 of 15
(3,498 Views)
thk u ..it look better than mine...Smiley Very Happy
i have another doubt let say i have empty field in the sed element,
how i can store it as SED9999, SED9999-1,...how to do tht????
 
0 Kudos
Message 10 of 15
(3,485 Views)