Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set variable to field value in load script

Hi all.

Is there anyone that could explain how I could set av varibale in my load script (SET Current_FC = BudgetType=('FC2 2013');) and then use the variable in a set analysis like:

sum({$<PeriodCounter={"$(#=max(PeriodCounter-1))"}, $(Current_FC) ,Cost_Center_ID-={'10600'}>} BudgetAmount) *-1/1000

Thanks in advance!

1 Solution

Accepted Solutions
karolina_
Creator II
Creator II

have you tried just SET Current_FC = 'FC2 2013';

because with {'FC2 2013'} you have double brackets BudgetType={{'FC2 2013'}}

or try
SET Current_FC = FC2 2013;

and then BudgetType={'$(Current_FC)'}>

View solution in original post

11 Replies
bbi_mba_76
Partner - Specialist
Partner - Specialist

Hi,

maybe this post could help you Setting a variable in script...

Clever_Anjos
Employee
Employee

Not applicable
Author

Thanks for reply. Unfortunately I did'nt find anything that solve my problem...

Not applicable
Author

Thanks for reply. Unfortunately I did'nt find anything that solve my problem...

Not applicable
Author

I would change a little the sentence for setting the variable:

SET Current_FC = BudgetType={'FC2 2013'}

Use curly brackets. In fact your variable should contain a true part of the set analysis syntax

Perhaps, also, use quotes: set Current_FC = "xxxx";  (due to the = sign in your text also)

Fabrice

Not applicable
Author

Not applicable
Author

Yes, I get the right value (BudgetType={'FC2 2013'}) for the variable if I look in the Variable Overview...

But i don't get the calculation right the I have the expression like this:


sum({$<PeriodCounter={"$(#=max(PeriodCounter-1))"}, BudgetType={$(Current_FC)} ,Cost_Center_ID-={'10600'}>} BudgetAmount) *-1/1000


Any suggestions?

Not applicable
Author

It seems correct. I would try to enclose the variable between quotes or brackets because there is a space (special character):

BudgetType = {[$(Current_FC)] }

Fabrice

Not applicable
Author

Thanks for reply! But it still doesn't work, I only get 0. Do you have any other suggestions?