How do you search variables in arrays

1,174 views
Skip to first unread message

Jakub

unread,
Apr 15, 2012, 8:39:35 AM4/15/12
to tas...@googlegroups.com
Tell me please your ways to search variable in arrays.
Example: I have array with numbers of missed phones and I want to seach this array for one number.
Thank you replays.

TW

unread,
Apr 15, 2012, 10:34:52 AM4/15/12
to tas...@googlegroups.com
first you need to get the position within th earray
Variable Set %POSINARRAY To %ARRAY(#?12345)

then you can get the value
Flash %ARRAY(%POSINARRAY)

Jakub

unread,
Apr 15, 2012, 11:12:38 AM4/15/12
to tas...@googlegroups.com
Yes. Thats the way I used to use. Trouble (better say: plenty of work) comes when I want to search in whole array. Maybe (in this case wish to Pent) action to search in arrays with deleting position or not, don't you think ?

Pent

unread,
Apr 15, 2012, 12:19:52 PM4/15/12
to Tasker
> Yes. Thats the way I used to use. Trouble (better say: plenty of work)
> comes when I want to search in whole array.

That's what (#?12345) does.

I think we're not understanding what you really want.

Pent

Jakub

unread,
Apr 15, 2012, 3:05:17 PM4/15/12
to tas...@googlegroups.com
Yes. Maybe I'm not clearly wrote.
Im creating profile to control missed calls. Its no problem to adding numbers to arrays but problem is when I try to search arrays for specyfic number to delete when I callback to missed call.
For now I have something like that:


Missed Calls Calendar (59)
A1: Variable Set [ Name:%MISSED_CALLS_CALENDAR_COUNT To:0 Do Maths:Off Append:Off ] 
<Check MISSED>
A2: Variable Add [ Name:%MISSED_CALLS_CALENDAR_COUNT Value:1 Wrap Around:0 ] 
A3: Stop [ With Error:Off ] If [ %CNUM ~ %MISSED_CALLS_CALENDAR(%MISSED_CALLS_CALENDAR_COUNT) ]
A4: Goto [ Type:Action Label Number:1 Label:Check MISSED ] If [ %MISSED_CALLS_CALENDAR_COUNT > %MISSED_CALLS_CALENDAR(#) ]
A5: Calendar Insert [ In / For (Minutes):240/1 Calendar:Google:Miąsik Jakub Title:Nieodebrane %CNUM Description:%CNAME Location: Available:On ] 

This is my version of searching in array.
I was thinking of new action with search specific data in array and delete it or not.

By the way --- in my case this task graphic in not correct I think (see below)

Pent

unread,
Apr 16, 2012, 2:57:12 AM4/16/12
to Tasker
> This is my version of searching in array.
> I was thinking of new action with search specific data in array and delete
> it or not.

Get the matching indices with #?, then delete the first one with Array
Pop. Do that
until no indices are returned by #?. You need to do that because
deleting an
element means the other indices are no longer correct.

Better would be to delete them starting at the end, but that's not
possible yet.

Pent

Jakub

unread,
Apr 16, 2012, 4:20:36 AM4/16/12
to tas...@googlegroups.com
Problem is in Array Pop:
I have variable %MISSED_CALLS_CALENDAR_COUNT but in Position in that action when I try to put that variable got: %MISSED_CALLS_CALEND.
Some restriction or limit ?
Reply all
Reply to author
Forward
0 new messages