0
votes

My SQL code gives me over 10 000 rows, each containing client id, name, address and so forth. In my PowerBuilder 10.5 window I've set my DataWindow in which I'm retrieving my SQL code using id as retrieve argument. I have a Single line Edit (sle_id) in which the user can write an id and search by it. What I've figured out is that all of my clients have id's length of 8 characters and starting with either "46XXXXXXXX" or "7052XXXX". So to optimize my retrieve time I want to write a code in the clicked event of my "Start" button that is located in PowerBuilder window that would first check if the id starts with one of does two options: "46..." or "7052...". I assume I'd need to use length of the characters? For example, this is what I'd want...

IF sle_id.text STARTS with 46 or 7052 THEN retrieve
ELSE MessageBox ("INFO", "Your id must have begin with either 32 or 7052")
END IF;

Of course, I need something better then "Starts with". Much oblige for all the help!

2

2 Answers

1
votes

there are some string functions in powerbuilder. I think you need this:

If( left(sle_id.text, 2) = "46" or left(sle_id.text, 4) = "7052" ) then

Best Regards

Gábor

0
votes

I think you're trying to solve the wrong problem. Your database should have an index on client id. If the client id is unique use a unique index.