Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Array comparison in if statement not working

Hi,

I have this if statement:

ElseIf vemail.Item(j).Text <> vemail.Item(j-1).Text Then

But it keeps stopping at this part. Is there something wrong with the syntax?

1 Solution

Accepted Solutions
marcus_sommer

Is your loop running at least one time - you could check such things with a msgbox on one of the loop-counter, maybe with:

msgbox j 'or other counters

It could be that your counter runs out of the number of array-member.

Further is your syntax of querying vemail.Item(j).Text correct, also here is a msgbox helpful:

var = vemail.Item(j).Text

msgbox var

- Marcus

View solution in original post

4 Replies
marcus_sommer

Is your loop running at least one time - you could check such things with a msgbox on one of the loop-counter, maybe with:

msgbox j 'or other counters

It could be that your counter runs out of the number of array-member.

Further is your syntax of querying vemail.Item(j).Text correct, also here is a msgbox helpful:

var = vemail.Item(j).Text

msgbox var

- Marcus

sifatnabil
Specialist
Specialist
Author

I tried all those, it's definitely something to do with the comparison of the array, e.g. it errors when using this: vemail.Item(1).Text <> vemail.Item(0).Text

Even though vemail does have values in Item(1) and Item(0). Everything else in the loop works.

sifatnabil
Specialist
Specialist
Author

Oh but this works:

var = vemail.Item(j).Text

msgbox var

So it's strange that a comparison wouldn't work.

sifatnabil
Specialist
Specialist
Author

I think I figured it out. It seems the if statement runs out of array members.