Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a variable that i define in the app directly. Let's call the variable v_DimensionToggle_Field for example.
It is created via the in-app variable panel, and set to "=SubField('$(v_DimensionToggle)', '§', 1)"
This works well, when the user selects a dimension, it correctly parses the string, and outputs the dimension to a chart, which then plots that dimension.
I'm trying to create this variable in the load script, not having any luck. I've tried things like
Set v_DimensionToggle_Field = =SubField('$(v_DimensionToggle)', '§', 1);
Set v_DimensionToggle_Field = =SubField($1, '§', 1); and using that with this in the chart =$(v_DimensionToggle_Field('$(v_DimensionToggle)'))
Can't seem to be able to create this variable I need directly in the load script.
Any help appreciated !
Ah. If this variable isn't something you're providing in script, that definitely makes life trickier for script-side variables.
You're going to have to either make it work with the parameterized version, or escape the dollar-sign expansion. Unfortunately, I'm not entirely sure what the exact method would be and do not have time to investigate right now. If I can, I will try and investigate further later.
All of these are using v_DimensionToggle, but you haven't included the definition for that particular variable.
You can assume string looks like dimension_field§dimension_uilabel. The parsing works well with the variable that is defined in the app directly, but can't get it to work when creating the variable in the load script
Based on that definition, your original attempt should work.
Set v_DimensionToggle_Field = =SubField('$(v_DimensionToggle)', '§', 1);
Front-end dimension:
=[$(v_DimensionToggle_Field)]
Script used to test:
Set v_DimensionToggle = 'dimension_field§dimension_uilabel';
Set v_DimensionToggle_Field = =SubField('$(v_DimensionToggle)', '§', 1);
Load '1' as dimension_field autogenerate(1);
It's odd. See below where I seem to be getting stuck. You can see v_test_var (created in app) is correctly evaluating the expression. You can see the v_DimensionToggle_Field is passed an empty value in the SubField function. I should mention the v_DimensionToggle is a variable that changes based on user input - it is not a static value.
Ah. If this variable isn't something you're providing in script, that definitely makes life trickier for script-side variables.
You're going to have to either make it work with the parameterized version, or escape the dollar-sign expansion. Unfortunately, I'm not entirely sure what the exact method would be and do not have time to investigate right now. If I can, I will try and investigate further later.
Ok, if you get the chance to have a look at some point, it would get me out of a pickle ! Thanks a lot
You had the right idea with escaping the character - managed to do it like this. Thanks for the idea
Let v_DimensionToggle_Field = '=SubField(' & chr(39) & chr(36) & '(v_DimensionToggle)' & chr(39) & ', ' & chr(39) & '§' & chr(39) & ', 1)';