<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Use Set Analysis as reference to a variable in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1563765#M742099</link>
    <description>&lt;P&gt;I am creating a QlikView template for my App that can be controlled from the script.&lt;/P&gt;&lt;P&gt;In the script I have a table with a referance to different colours and other attributes for each sheet. I am not very familiar with referencing variables and I struggle to reference a variable from the table into a set analysis, which again is supposed to be interpreted as a variable to change the colour of the background of the sheets.&lt;/P&gt;&lt;P&gt;Can anyone please help me to create the Set Variable and the syntax for referencing it in the colour of a textbox?&lt;/P&gt;&lt;PRE&gt;// Define my set of colours
Let vColour1				= rgb(248,248,248);
Let vColour2				= rgb(39,174,96);

Define the parameters for each sheet
SheetDesignParameters:
LOAD*INLINE
[
sheet_id,	sheet_title,	sheet_colour_background,
Document\SH01,	Overview,	vColour4,
Document\SH02,	12-Cell,	vColour4,
];

// Returns the active sheet ID
Set vActiveSheetID = GetActiveSheetId();
// Returns the row number of the sheet-id from the array  
Set vFieldIndex = FieldIndex('sheet_id',$(vActiveSheetID));
&lt;BR /&gt;//first try, but does not work because the values in the table are not unique &lt;BR /&gt;Set vSheetColourBackground = FieldValue('sheet_colour_background', $(vFieldIndex));&lt;BR /&gt;
// second try, shows the string "vColour4" if I put the code directly in a textbox in the first sheet, but does not change colour.
Set TestTwo =Only({$&amp;lt;sheet_id= {'$(=$(vActiveSheetID))' }&amp;gt;}sheet_colour_background);&lt;/PRE&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:59:05 GMT</pubDate>
    <dc:creator>SupplyAndDemand</dc:creator>
    <dc:date>2024-11-16T03:59:05Z</dc:date>
    <item>
      <title>Use Set Analysis as reference to a variable</title>
      <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1563765#M742099</link>
      <description>&lt;P&gt;I am creating a QlikView template for my App that can be controlled from the script.&lt;/P&gt;&lt;P&gt;In the script I have a table with a referance to different colours and other attributes for each sheet. I am not very familiar with referencing variables and I struggle to reference a variable from the table into a set analysis, which again is supposed to be interpreted as a variable to change the colour of the background of the sheets.&lt;/P&gt;&lt;P&gt;Can anyone please help me to create the Set Variable and the syntax for referencing it in the colour of a textbox?&lt;/P&gt;&lt;PRE&gt;// Define my set of colours
Let vColour1				= rgb(248,248,248);
Let vColour2				= rgb(39,174,96);

Define the parameters for each sheet
SheetDesignParameters:
LOAD*INLINE
[
sheet_id,	sheet_title,	sheet_colour_background,
Document\SH01,	Overview,	vColour4,
Document\SH02,	12-Cell,	vColour4,
];

// Returns the active sheet ID
Set vActiveSheetID = GetActiveSheetId();
// Returns the row number of the sheet-id from the array  
Set vFieldIndex = FieldIndex('sheet_id',$(vActiveSheetID));
&lt;BR /&gt;//first try, but does not work because the values in the table are not unique &lt;BR /&gt;Set vSheetColourBackground = FieldValue('sheet_colour_background', $(vFieldIndex));&lt;BR /&gt;
// second try, shows the string "vColour4" if I put the code directly in a textbox in the first sheet, but does not change colour.
Set TestTwo =Only({$&amp;lt;sheet_id= {'$(=$(vActiveSheetID))' }&amp;gt;}sheet_colour_background);&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:59:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1563765#M742099</guid>
      <dc:creator>SupplyAndDemand</dc:creator>
      <dc:date>2024-11-16T03:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Use Set Analysis as reference to a variable</title>
      <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564054#M742100</link>
      <description>&lt;P&gt;I think there are too much variables. This doesn't mean that there is no way to get it to work with a whole bunch of variables but IMO it doesn't simplify the task (which is the main-use of variables) else it makes it more complex. Therefore I suggest to load all parameters in a table by formatting the rgb() with num() to get the color-index of your needed colors and then using them instead of the rgb() which is without a $-sign expansion just a string. This means something like:&lt;/P&gt;&lt;P&gt;LOAD *, num(evaluate(sheet_colour_background)) as ColorIndex INLINE [&lt;BR /&gt;sheet_id, sheet_title, sheet_colour_background&lt;BR /&gt;Document\SH01, Overview, "rgb(248,248,248)"&lt;BR /&gt;Document\SH02, 12-Cell, "rgb(39,174,96)"];&lt;/P&gt;&lt;PRE&gt;Only({$&amp;lt;sheet_id= {'$(=GetActiveSheetID())'}&amp;gt;} ColorIndex)&lt;/PRE&gt;&lt;P&gt;and based of it it might be useful to create some kind of custom function with:&lt;/P&gt;&lt;PRE&gt;varReturn: Only({$&amp;lt;sheet_id= {'$(=GetActiveSheetID())'}&amp;gt;} $1)&lt;/PRE&gt;&lt;P&gt;$(varReturn(ColorIndex))&lt;/P&gt;&lt;P&gt;to choose the returning field.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2019 15:00:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564054#M742100</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-04-02T15:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Use Set Analysis as reference to a variable</title>
      <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564479#M742101</link>
      <description>&lt;P&gt;Thank you Marcus, the evaluate did work and I can now show my colors from the table (did not have to write the rgb(), could just reference to vColour1). I am not an advanced user, so I dont know how to create the custom function you mentioned. I ended up putting the expression into all the objects manually on the main page. (This main page should be copied and pasted as a link to create more pages). The only important thing missing is now to get the title of the sheets on the change tab buttons instead of the document ID, and I cant seem to get that to work. Do you have any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached the project I am working on, so you can better understand what I am trying to do. (Also if you have other comments, I would appreciate the feedback).&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 16:07:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564479#M742101</guid>
      <dc:creator>SupplyAndDemand</dc:creator>
      <dc:date>2019-04-08T16:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use Set Analysis as reference to a variable</title>
      <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564611#M742102</link>
      <description>&lt;P&gt;The custom function could be easily defined within the variable-editor. It's also possible within the script but it need more or less expensive adjustments in regard to quotes and used $-signs - usually it's not worth to go this way and should really various of such variables be created within the script a load of them from an external source would be the better approach.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CustomFunction.JPG" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/9386i81B560461CE76D81/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CustomFunction.JPG" alt="CustomFunction.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In regard to your button-labels - you need just define them within your table like all the other id's, colors and so on.&lt;/P&gt;&lt;P&gt;Beside this I don't recommend such an approach to create an UI because the efforts to create all these variables, buttons and textboxes and implement it everywhere is enormously and IMO without a real benefit. Especially as a starter in Qlik it could cost weeks or even months to implement here a stable and flexible solution.&lt;/P&gt;&lt;P&gt;Why not just using the "normal" way by using the common sheet-tabs, listboxes and so on. Most of the functionalities and layouts could be reached with it. If templates for sheets and/or objects are needed you could use themes to define various colors and other properties - whereby even this might not be necessary. Usually I use just a copy + paste approach to duplicate applications, sheets and objects and if necessary I adjust them to the new requirement.&lt;/P&gt;&lt;P&gt;Nevertheless if you want to continue with your approach I suggest to read &lt;A href="https://community.qlik.com/t5/QlikView-Documents/Variables/ta-p/1497368" target="_blank" rel="noopener"&gt;Variables&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 03 Apr 2019 13:35:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1564611#M742102</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-04-03T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use Set Analysis as reference to a variable</title>
      <link>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1565594#M742103</link>
      <description>&lt;P&gt;You are right, I lost my perspective trying to make this task work for so long. After your suggestion I took a step back and realized I was almost trying to recreate the tab row. It was hard to delete, but I ended up removing all the sheet specific variables and the change tab button. I replaced them with a show/hide and a color variable per section. Looks pretty good and are actually more flexible and easy then my previous version. Thank you for your time!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 07:10:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-Set-Analysis-as-reference-to-a-variable/m-p/1565594#M742103</guid>
      <dc:creator>SupplyAndDemand</dc:creator>
      <dc:date>2019-04-05T07:10:19Z</dc:date>
    </item>
  </channel>
</rss>

