Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I'm french and i'm working at present in a company for a work experience placement. They put me on a computer and i'm using for the first time Qlikview. I have to make a programme which going to classify by order of urgency products to make. Somewherre, i make a dynamic crossed board and in this one, i add a calculated dimension to transform a basic date into a date with this syntax : 20**/W** ( W = week ) thanks to this function, this is my code ( don't worry about what is inside ) : =WeekName( if( Date_Liss>4000,Date_Liss+3*7,Sem_Mont) ).
But I wonder if it's possible to write it in the script as a variable and call it in my board with ( $ ) for example ( sorry I'm a real beginner ).
Thanks for your herlp.
Hi Jeremy,
don't worry. You'll get lots of help here. The integrated help_file in the software can also be helpful, and maybe you have access to a book on QlikView? Most of them are pretty good.
A function in a variable is pretty "easy" - once you know how 😉
Just open the variable_editor (Ctrl+Alt+V) and enter a new variable there, typing the formula, but without an '='.
=> Then you have to call the variable with $([variable]) - that way, QlikView will evaluate the formula inside the brackets and use the result (in comparison, when you just write the[variable_name] in a given place, QlikView uses exactly what is there).
You can also write your formula in the script using SET - there are just some things (set_analysis) that cannot be done in the script.
HTH
Best regards,
DataNibbler
Thank you and what will be the true syntax of the code if i want to write it in the script with SET please ? I'm not still really confortable with Set Analysis, I started Qlikview yesterday and i started to read pdf about Set Analaysis this mornig ( 1 hour ago ).
Hi,
as I said, set_analysis is not possible in the script.
If you want to do it, the syntax would be like this:
>>> SET [e_something] = WeekName( if( Date_Liss>4000,Date_Liss+3*7,Sem_Mont) ); <<<
=> Don't forget to close off the command with a ';'.
=> Keep in mind, the script is executed strictly left_to_right and top_down and both the ?fields? Date_Liss and Sem_Mont have to be available at the time that variable is created.
P.S.: I think you'd better mark my answer as "helpful", not "correct" - the way it is now, others will have the impression that your issue is solved because it appears green and they won't bother looking in. I'm happy to help, but I don't have the time to be the only one helping you along. It works better in the Community.
To help you this is a part of my script which interest us :
LOAD RP as NAV_RP_IND,
Désignation,
[Numéro LPR],
[CDM-Nom],
mid( [CDM-Nom] , 1+index( [CDM-Nom] ,' '))as Zone_L,
[Semaine de montage dans OPX2],
[Semaine de montage dans lissage],
MakeWeekDate(right([Semaine de montage dans lissage],4),mid([Semaine de montage dans lissage],2,2))as Date_Liss,
MakeWeekDate(right([Semaine de montage dans OPX2],4),mid([Semaine de montage dans OPX2],2,2))as Date_Mont_Liss
FROM
(
So I have to write the SET into the load of the field or outside ?
Hi,
you would need to write it before so the variable is ready and can be used in the LOAD - but wait:
=> You are going to use that formula in a LOAD in the script? Several times or only once?
=> If you're using it only once in a LOAD, putting it in a variable won't add any value for you - the script is executed
only once anyway. The added_value would be there if you want to use this formula on the GUI where it's used
every time the user makes any selection or stuff.
Hi
Open QV Document-->Setting-->Variable Overview-->Add -->Now qv will ask for Variable name ( by default it is Varible 1, you can keep it or change as per your understanding)-->In defintion field add your formula i.e WeekName( if( Date_Liss>4000,Date_Liss+3*7,Sem_Mont) ) --->Click on OK
Now your variable is defined. It will calculate as per your requirement
and Instead of putting formula you can use this variable name.
I just want to create a variable with ( weekname(if ..... ) ) just to don't have to write it in the properties of the board and just write $([ Variable ]) but first of all i choose your first idea with Ctrl+Alt+V but i did what you say but when i apply it my board became empty with the sentence : " Overtaking of the assigned memory ".
What's the matter ?
yes thank you but as I said before i've a matter of " Overtaking of the assigned memory " when I do that and when i add a calculated dimension with for expression $([ Variable ])
on front end side press ctrl+alt+v
add variable myvariable and write below code
= WeekName( if(Date_Liss>4000,Date_Liss+3*7,Sem_Mont) )
here on starting write Equal sign means through this variable myvariable You evaluate the expression rather than to make it as string.
hope it helps