Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In my load script I have a variable containing a numeric value.
I want to use this variable in an Inline load.
The formula I use is : This is my text $(variable)-1
So when the value of $(variable) = 2020 the result should be : This is my text 2019
I tried a lot of various syntaxis but all of them fail (for example $(=$(variable) -1)
Is is possible to achieve my goal , if possible ....how ?
what is your desired outcome? what values do you want loaded in the table. the inline load is intended to load into a table a list of values. if you are using a variable, then there will only be 1 value. so did you need only one line? if so use instead autogenerate(1)
if you need multiple lines, you may need to explain the desired outcome.
assuming that some part of your code you stored 2020 into your variable:
load
'This is my text ' & ($(variable)-1) as fieldName
autogenerate(1);
even if you want to use this as part of your inline, you can do it a few ways, but if you want to separate the text from the calculation make sure your calculation is bracketed. if you use 'this is my text' & $(variable) - 1, this part is done first: 'this is my text' & $(variable)
then adding 1 to that will fail
Hello @edwin
Can you really do this in an inline? To my knowledge you can expand variables in an inline, but you can't perform any calculations, everything is treated as fixed values. But I learn new things every day so please give an example how you would do this if it is possible 🙂
For example, If this: 'this is my text' & $(variable) is loaded in an inline Qlik will treat it as a fixed value and the output will be 'this is my text' & 2020, not this is my text 2020.
@curiousfellow As suggested by Edwin using autogenrate might be a better solution than an inline. But if you need to use an inline, creating a second variable before your inline is probably the easiest solution. Create a variable2 from your variable that contains the full string This is my text 2019 and load this in your inline instead.
i agree that the data in the inline is static. however, you can add any expression in the load part :
load 'this is a test ' & '$(vVariable)' as note, A, B, C inline [
A, B, C
......
];
as you can see you can perform expressions on your loaded fields as well:
A + B as NewField,
Yes, lot's of way to do it outside of the actual inline, but not in it, that what I was hoping for here. If it is one thing I've learn with Qlik is always expect someone to have a solution for what you believe can't be done 🙂
Thank you all for your response. My goal was to reduce the number of variables. In this case I have to deal with extra variables.