Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

variable expansion with multiple parameters containing commas

Hi all,

I have the following multiple parameters function:

round( ($1) * 86400 ) - round( ($2) * 86400 )

defined as eDateDiff in Variable Overview.

I call it from an expression chart like that:

$(eDateDiff(DATA_APP+NumMax(1,DURATA)*FRAZ*1440,DAY+DALLE))

unfortunately the comma in the NumMax is interpreted as the parameter separator of the eDateDiff function and I get this:

round( (DATA_APP+NumMax(1) * 86400 ) - round( (DURATA)*FRAZ*1440) * 86400 )

which is clearly wrong.

What am I doing wrong? Any suggestion?

Thank in advance for you help,

Fil

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I think you're doing it exactly like you should.  Unfortunately, QlikView disagrees, as it has a bug that prevents you from using commas in the parameters.  Now, I'm calling it a bug, but I suspect QlikTech would call it working as designed, and we'd need to submit a feature request to allow this approach to actually work.  So don't hold your breath waiting for them to fix it.  In the mean time, we need a workaround.

I'm trying to remember how I've worked around it, as I know I've encountered it before.  But I'm thinking all I did was figure out how to write the parameter in a way that didn't have commas.  I don't see how to do that in your case.

I believe the inner dollar sign expansion would occur first, which would prevent you from just making another variable to hold your sub expression.  All I can think to do is make an eDateDiff2 "function" that includes your additional calculations:

round(($1+rangemax(1,$2)*$3)*86400)-round(($4+$5)*86400)

Hopefully there's a better way, because I hate that solution, but I'm not thinking of anything else right now.

Oh, and use rangemax() not nummax().  Per the help text, "The nummax function is now obsolete and is superceded by the rangemax function."

View solution in original post

5 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Can you provide me some more info.

   Like eDateDiff is a function..?

 

   Where are you using the round function.

   Please give details

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

eDateDiff is a variable with two parameters $1 and $2:

round( ($1) * 86400 ) - round( ($2) * 86400 )

Its objective is to compute the difference between two dates in seconds and rounding to seconds too.

However the problem is general and is due to the passing an expressin with commas as variable parameter. In this case the comma is interpreted as parameter separator.

Probably it's only a matter of dollar sign expansion but I don't know how to solve it.

I hope I have been clear enough. Otherwise I'l try to post a simplier example.

Thank you

Fil

johnw
Champion III
Champion III

I think you're doing it exactly like you should.  Unfortunately, QlikView disagrees, as it has a bug that prevents you from using commas in the parameters.  Now, I'm calling it a bug, but I suspect QlikTech would call it working as designed, and we'd need to submit a feature request to allow this approach to actually work.  So don't hold your breath waiting for them to fix it.  In the mean time, we need a workaround.

I'm trying to remember how I've worked around it, as I know I've encountered it before.  But I'm thinking all I did was figure out how to write the parameter in a way that didn't have commas.  I don't see how to do that in your case.

I believe the inner dollar sign expansion would occur first, which would prevent you from just making another variable to hold your sub expression.  All I can think to do is make an eDateDiff2 "function" that includes your additional calculations:

round(($1+rangemax(1,$2)*$3)*86400)-round(($4+$5)*86400)

Hopefully there's a better way, because I hate that solution, but I'm not thinking of anything else right now.

Oh, and use rangemax() not nummax().  Per the help text, "The nummax function is now obsolete and is superceded by the rangemax function."

Not applicable
Author

Thank you very much John. Now that I know where the problem is I'll find some other way!

Also thank you for the rangemax hint.

Bye

Fil

Anonymous
Not applicable
Author

i know this is an old post but i hope someone like me will find it useful. Dmitri Gudkov wrote an awesome post and described workarounds to the issue with commas

http://bi-review.blogspot.com/2012/05/how-to-write-reusable-and-expandable.html