How do I do a search in an array?

Get help using Construct 2

Post » Mon Apr 24, 2017 5:32 am

I've spent 2 days on this darn blasted problem. All I want to do is load values into an array and then do a search in the array for a value and if it is in the array to then populate a text box. I've looked at all the tutorials/videos and it just ain't working.

Here's a link to the capx file: https://drive.google.com/open?id=0B8diIdBYzw0cc3lZRFF1R21nOFk

What am I doing wrong?

Thanks much!
B
23
S
10
G
1
Posts: 41
Reputation: 2,259

Post » Mon Apr 24, 2017 6:25 am

You need to "Save as single file" and post that.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon Apr 24, 2017 6:43 am

My bad...thanks Blackhornet. Here's the link to the single file:

https://drive.google.com/open?id=0B8diIdBYzw0cQU1YVlJtYjE3TFU
B
23
S
10
G
1
Posts: 41
Reputation: 2,259

Post » Mon Apr 24, 2017 1:15 pm

The problem is you aren't stripping out the 'newlines', since they still count as characters, but you are separating on '|'. Use trim(tokenat(ajax.LastData,d,"|")) as your value to get rid of the extra whitespace, in this case.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Mon Apr 24, 2017 7:51 pm

Super Thanks, BlackHornet!

Follow-up Question: Why don't any of the "available" tutorials (video or otherwise) have that language in their solutions, but they apparently still work?

Again mucho thanks!
B
23
S
10
G
1
Posts: 41
Reputation: 2,259


Return to How do I....?

Who is online

Users browsing this forum: NadeemAbbass, plinkie, Yahoo [Bot] and 8 guests