Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do code IF order NOT qualifies

Status
Not open for further replies.

Chotor

Technical User
Oct 2, 2008
20
NO
This is more a general programming question than a specific Extra Basic question.

I have a list of maybe 200 (or more) orders.
I do a request for orders many times daily.

Now I want to execute a specific code if order is NOT qualified (which is maybe 180 of them).
(10% of orders qualify, that's why it's better to list them than to list all the other 90%)

Code:
pseudocode
Make a list of orders which qualify 
IF selected_item IS NOT (part of orders group) THEN
    DO CODE

Please just ask if I need to clarify.
 




"I have a list of maybe 200 (or more) orders."

Where? In a database table, in a flat file, on a spreadsheet???

psudo code for an approch...
Code:
'selected_item has been assigned
'quallified_items is your list of quallified orders 
bFound = false
for i = 1 to quallified_items(quallified_items.count)
   if selected_item = quallified_items(i) then
      bFound = true
      exit for
   end if
next
if not bfound then
   'selected_item not found
end if

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks.

That code will most likely do the job.
I was looking for something neater, though.

Something with booleans.
Like where the list of my qualified items are TRUE, and if I compare my selected element to that list, it renders FALSE (since that item is not in list).

Something like
Code:
qualified_item = {"Han Solo", "Luke", "Leia", "Obi Wan", "C3PO"} '(this list will have 20 or more elements)
selected_item = "Darth Vader"
IF selected_item IS ELEMENT OF qualified_item THEN ...
 



If THAT list is STATIC, then make a list (table) of those items and run that list.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
The (qualified) list is static, but selected element is not (Darth Vader is just an example).

I want to know if selected element is on that list or not (within an IF).
 

They you have your answer. In case you have not noticed, code can be tedious.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Yes, I realize that.

Any tips as to how to get the length of an array in this language?

This programming language is pretty ...emmm... BASIC. :p
 



Ubound, just like VB.

Have you checked Extra Help?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Haha! I know I ask a lot. Sorry about that.

Yes, I have checked the help file, but couldn't find a separate section with "Arrays". It's just scattered here and there. Now when I know it, I see ubound when I search for arrays.

My main language is Java. I'm not very familiar with VBA, so I have to google and/or ask eher for about every passage I'm coding.

Thanks a lot for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top