Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi!
I've created some varibles that works like functions.
Example:
variable fVerbaSup
(
sum(
{
$<[Comprador]={$1},[Modalidade]={'SUPERMERCADO'}>
}
[Valor Verba]
)
)
Where $1 is the parameter.
I use it with success like:
$(fVerbaSup( "888 |*"))
But I could not pass more then one Comprador in the same parameter, like:
$(fVerbaSup( "888 |*", "304 |*" ))
It does not work and returns the sum of Valor Verba from Comprador 888 only.
Strange is the fact that if I do not create a variable and use the sum directly in the object, it works, like:
(
sum(
{
$<[Comprador]={"888 |*", "304 |*" },[Modalidade]={'SUPERMERCADO'}>
}
[Valor Verba]
)
)
Anybody has a suggestion on how I could pass more then one Comprador in the SAME PARAMETER?
I tried a lot of combinations without success.
$(fVerbaSup( "888 |*", "304 |*" ))
It must be in the same parameter because I have many others functions that will receive 1, 2, 3 or N Comprador.
Thank you!
You cannot use a comma as part of the parameter value. Even though it is in quotes, the comma will be treated as a parameter separator and 304 will be assigned to $2.
The only workaround I've found is to use a proxy character for the comma and do a replace in the expression. Something like:
$<[Comprador]={$(=replace('$1','@',',')},[Modalidade]={'SUPERMERCADO'}>
and
$(fVerbaSup( "888 |*"@ "304 |*" ))
-Rob
You cannot use a comma as part of the parameter value. Even though it is in quotes, the comma will be treated as a parameter separator and 304 will be assigned to $2.
The only workaround I've found is to use a proxy character for the comma and do a replace in the expression. Something like:
$<[Comprador]={$(=replace('$1','@',',')},[Modalidade]={'SUPERMERCADO'}>
and
$(fVerbaSup( "888 |*"@ "304 |*" ))
-Rob
Did not work.
I'm doing more tests.
It worked now. Your code was missing another ) character.
(
sum(
{
$<[Comprador]={ $(=replace('$1', '@', ',')) },[Modalidade]={'SUPERMERCADO'}>
}
[Valor Verba]
)
)
Thank you very much!!
"It worked now. Your code was missing another ) character."
That's why I said "Something like"
Glad you got it working!
-Rob
If it's just multiple (selections) values you could use a different syntax to avoid the comma-issue. Try it with:
$(fVerbaSup(("888 |*"|"304 |*")))
- Marcus