Qlik Community

QlikView Deployment

Discussion Board for collaboration related to QlikView Deployment.

marson_esqogito
New Contributor II

replacement field to operation

Hi,

i have a similar table

and i would like to have a similar result without using "if" expression (see the 4° column) like the 5° column (that obviously don't work)

some suggestions?

many thanks

Mauro

Tags (2)
1 Solution

Accepted Solutions
morganaaron
Valued Contributor

Re: replacement field to operation

Or you can use

Pick(Match(F2, '/', '*'), F1/F3, F1*F3)

in the expression, which would replicate what you're trying to do!

6 Replies
morganaaron
Valued Contributor

Re: replacement field to operation

If you can add it into your load:

Load Evaluate(F1 & F2 & F3) as Result,
*
Inline [
F1, F2, F3
10, /, 5
20, *, 5
]
;

Would give you what you want.

marson_esqogito
New Contributor II

Re: replacement field to operation

Thanks,

but there is no possibility to make this evaluation on expression?

my example is simple, but in the production file the situation is more complex.

qvelhoff
Valued Contributor

Re: replacement field to operation

You could with an IF statement, but it may slow down your load.

IF(F2 = '/',F1/F3,

IF(F2 = '*', F1/F3))

Another option is to use the PICK function after you create an INLINE table with the ID of the operation you'd like to perform.

PICK(%PICKID, F1/F3,

F1*F3))

marson_esqogito
New Contributor II

Re: replacement field to operation

like i said in the first question,

"If" statement is not usable , the update of the table object is too slow and use so much RAM.

qvelhoff
Valued Contributor

Re: replacement field to operation

It's not possible without using an IF statement or a PICK statement.  However, PICK will take a lot less ram up than the IF.

Create the Inline like:

PICKOp:

LOAD * INLINE [

    %OpID, %Operation

    1, F1 / F3

    2, F1 * F3

];

Then

PICK(%OpID,

SUM(F1)/SUM(F3),

SUM(F1)*SUM(F3))

If you don't want to SUM, just do F1/F3, F1*F3

morganaaron
Valued Contributor

Re: replacement field to operation

Or you can use

Pick(Match(F2, '/', '*'), F1/F3, F1*F3)

in the expression, which would replicate what you're trying to do!

Community Browser