Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
alanmcgrath
Creator
Creator

If RowNo with variable

I have a straight table in my application with a drill down group dimension.  I have mapped in target values using a mapping load to my data set based on each of the dimensions in the group.  I then have a variable that grabs the target value associated with whatever dimension is drilled in to.  However, during the mapping load the Total targets don't come in since there is no "Total" in my dimension. I still need to display the total target on the total line so I am trying to use an IF statement to bring in the static total target if the row is 0  but I'm getting an error.

The variable works fine on its own in the expression but once I add the "If" it errors out saying its expecting a ')'.  On the flip side if I use the If without the variable it also works fine.  What am I missing??

The If I'm using is:     =If(RowNo()=0, .87, $(vChgTarg_Org))

1 Solution

Accepted Solutions
swuehl
MVP
MVP

10 Replies
swuehl
MVP
MVP

And what is the exact definition of that variable?

alanmcgrath
Creator
Creator
Author

=If(GetSelectedCount(OrgUnit1) >0 and GetSelectedCount(OrgUnit2)>0, ChgOrg3, If(GetSelectedCount(OrgUnit1)>0,ChgOrg2, If(GetSelectedCount(OrgUnit1)=0,ChgOrg1,'')))

My dimension group contains OrgUnit1, OrgUnit2, OrgUnit3, OrgUnit4 and so on, up to OrgUnit10.  the ChgOrg# is the target associated with that level in the dimension. So ChgOrg3 will match up with OrgUnit3, ChgOrg2 will match up with OrgUnit2, etc.

This variable works fine in the expression but I obviously get a blank/Null on the total row.  I want .87 to come in on the total row, but the If(RowNo expression doesn't seem to be working.

Thanks!

swuehl
MVP
MVP

Try

If(Dimensionality()=0, ...., ...)

alanmcgrath
Creator
Creator
Author

Still get the same error - expecting ')' . but in the expression window is shows as expression ok.  I guess it doesn't like the variable combined with the If. seems odd to me.

swuehl
MVP
MVP

Does the variable maybe expand to an expression including the leading equal sign?

alanmcgrath
Creator
Creator
Author

It will show the text of the expression of the variable in the straight table if I remove the dollar expansion from the variable in the straight table's expression or if I remove the leading = from the variable definition.  Otherwise the whole straight table shows blank with that error message.

swuehl
MVP
MVP

I believe your issue (with the error message) is caused by the way you've defined your variable and how you call the variable.

See

The Magic of Variables

Could you maybe post a small sample QVW to get a better view of your setting?

alanmcgrath
Creator
Creator
Author

I added a sample QVW to the original message.  The column "Chg Tgt" is where I'm using the expression.  the table on the left shows that column working when I use just the variable and the column on the right shows it not working when I add the If(RowNo statement.  I need to get .87 into the total line

swuehl
MVP
MVP

Maybe like this?