Source language: Translate to:

Loop // Str Search

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Loop // Str Search

Postby TinTin » Thu Sep 08, 2016 1:41 am

... this should work right???... :-(

Original strings are
[Book_1]
[Book_2]
[Book_3]
etc



Loop 1 10 [pos]
StrSearch "New Book" "[Book_[pos]]" [Book_Icon]
If [Book_Icon] > 0
MessageBox "Book Found" "Yes" "OK" ""
Endif
EndLoop
TinTin
 
Posts: 162
Joined: Sun Dec 06, 2009 4:03 am
Location: UK

Re: Loop // Str Search

Postby Gaev » Thu Sep 08, 2016 6:46 am

TinTin:

Try this code ...
Code: Select all
CreateArray [Book_] "Apple,Banana,Cherry"

Loop 0 2 [pos]
     StrSearch "Banana" "[Book_([pos])]" [Book_Icon]
     AlertBox "Search" "[Book_([pos])] ... [Book_Icon]" ""
EndLoop


Note ...

1) I used CreateArray command ... array variables will be [Book_0] to [Book_2]

2) Use ( ) to reference individual array items e.g. [Book_(1)] or [Book_([pos])]

3) Use AlertBox instead of MessageBox ... the latter is used to ...
Display a custom message box and store the selected option as a number (1 for first, 2 for second... or zero for none) in a variable.


Be aware that when you use AlertBox within an event, they are all displayed at the end of the processing of that event ... overlayed on top of each other ... so, you will see the displays in the order [Book_2], {Book_1] and [Book_0]
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Loop // Str Search

Postby TinTin » Thu Sep 08, 2016 7:26 am

Cheers Gaev,

I'll give this a go, nice solution.


Cheers
TinTin
 
Posts: 162
Joined: Sun Dec 06, 2009 4:03 am
Location: UK


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron