Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pushing Value from a table box into a variable

Hello all,

I have this table box:

error loading image

Now I want to push the "Exhange rate" from the currency code "EUR" into a variable.

How can I do that. has anyone an idea?
Thanks for your help.

Regards CH

5 Replies
colinh
Partner - Creator II
Partner - Creator II

I would do this in the script. Without checking the syntax exactly it would be something like:

EuroRate:

load ExchangeRate resident ExchangeRates where CurrencyCode = 'EUR';

let vEuroRate = fieldvalue('ExchangeRate', 1);

drop table EuroRate;

Your load statement might need to be a bit more complex if you have multiple valid dates and you want to select the latest rate, but it will be something along those lines.

Hope this is useful.

Not applicable
Author

Hello Colin,

thanks for your answer.

But this doesn't work for me. I forgot to say, that there are more than one currency codes for Euro behind in this table and I have filtered the actual currency code via the date in a formula.

The fieldvalue formula I have tested, but I always get another value for it.

Anyway, for me I need to push this value out of this table into a variable. What I can do is to filter out the other currencys, so I only have "EUR" if this helps.

Regards CH

colinh
Partner - Creator II
Partner - Creator II

OK. So the exchange rate is based on a formula, not a single value from a table? In that case can you create a formula that gives you the Euro rate only? Then create a variable (Settings > Variables > Add) and enter that formula as the variable value (with a = sign, otherwise it will just be text). Use an Input Box to check the variable value.

Not applicable
Author

Hi CH

You can extract that value using a macro. If you look at the Qlikview API there are functions which can extract data from a specific column:row so by first iterating over your table finding which row 'EUR' is on and then extracting that value you can then put it in a variable.

I'll try to find an example later on today if I can find the time.

Not applicable
Author

Thank you both.

I didn't come much further. I have checked with triggers, but this doesnt work.

With Macro could you send me an example, please?

Thanks in advance.

Regards CH