Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in expression (challenge !)

Hello,

I have a new challenge !

For one project based on exchange rate, I have created 100 variable like this :

In loading script :

Currency_Table_tmp:

load distinct Currency Resident ExchangeRates;

LET vRows = NoOfRows('Currency_Table_tmp');

FOR i = 0 to $(vRows)-1

  LET vCurrency = Peek('Currency',$(i),'Currency_Table_tmp');

  if(len('$(vCurrency)') > 0) then

  Set $(vCurrency)_TO_GBP = 1;

  Set $(vCurrency)_TO_EUR = 1;

  end if;

NEXT

One example for a currency AUD:

Variable created : AUD_TO_GBP & AUD_TO_EUR

User can change the rate manually inside the application, that's why I need to create all variables

Now, I'm trying to use dynamically the variable into a table :

My goal is to get that :

Currency (dimension) / Sales  GBP (expression) / Sales  Euro (expression)

AUD / sum(Local Sales) * AUD_TO_GBP / sum(Sales) * AUD_TO_Euro


Don't forget AUD_TO_GBP is a variable and not a column.


I have tried to do that

=sum(Local Sales) *  $('=only(Currency') & '_TO_EUR')


But Qlikview doesn't understand this :

$('=only(Currency') & '_TO_EUR') => the goal is to have the value of this variable (AUD_TO_EUR) and it depends on the currency name in my table



Any idea ?






2 Replies
Gysbert_Wassenaar

Perhaps =sum(Local Sales) *  $($('=only(Currency') & '_TO_EUR')).

If not, please post a qlikview document that demonstrates the problem.


talk is cheap, supply exceeds demand
its_anandrjs

Hi,

I suppose you can use individual variables for the currency and use that variables into the expression where you can use that expression.

Regards

Anand