on 2024 Nov 07 7:42 PM
I have a requirement to create variables at Story level, when the user opens up/refresh the story, he/she has to see the variable prompt with Mandatory and Optional variables to enter values.
When i try to create a variable, i can see the below.
I can create variables at Model level but unable to create a Story Level.
I searched everywhere, but no luck, Could someone please help me?
Request clarification before answering.
Hi @Sumalini,
variables depend on the type of model you´re using. Let´s assume you have a BW live connection: Here you simply define the variable in the BW query and set it to mandatory. If you then use this model in a story, you´ll get a variable pop-up as designer and are able to define, if you want to set a fixed value or show the pop-up for every user.
Based on your question, I guess you´re using an import model.I´d personally not use variables for your case, but I´ll describe it anyways below. But first here´s an option I do prefer to do (which does require scripting):
Anyways: Here´s the info about model variables:
As soon as you create a model variable in the model - and use this model in your story, of course - you´ll see the option to set this variable:
But please keep in mind, that - beside switching the value of the variable - you can´t really do anything with the variable in the story.
Let´s assume you have model with the dimensions "Date" and "TestDimension" and the measure "Value". You can now set up a variable like this:
This variable can then be used in a calculated measure within the model:
If you upload the following data:
| Date | TestDimension | Value |
| 01.01.2024 | A | 1 |
| 01.02.2024 | B | 2 |
| 01.03.2024 | C | 4 |
| 01.04.2024 | A | 8 |
| 01.05.2024 | B | 16 |
| 01.06.2024 | C | 32 |
| 01.07.2024 | A | 64 |
| 01.08.2024 | B | 128 |
| 01.09.2024 | C | 256 |
| 01.10.2024 | A | 512 |
| 01.11.2024 | B | 1024 |
| 01.12.2024 | C | 2048 |
and use the model data in the story, the result will be:
If you now switch the varible value in the story to be, the calculated measure will only show the value of "1170" in the row of TestDimension "B":
When you do add the model to the story, you do get the following pup-up:
So you can decide whether the user should get the pop-up whenever the story is opened.
Please keep in mind, that model variables does not offer any setting for mandatory / optional.
You can at least check the value of the selected variables using a script like:
var mv_TestVar1Value = Table_1.getDataSource().getVariableValues("mv_TestVar1");
Best regards,
Denis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.