Qlik Community

Ask a Question

Suggest an Idea

Vote for your favorite Qlik product ideas and add your own suggestions.

Announcements
QlikWorld Online 2021, May 10-12: Our Free, Virtual, Global Event REGISTER TODAY

Always One Selected value - configure from script/keep setting across binary load

pjaredchurch
Contributor III
Contributor III

Always One Selected value - configure from script/keep setting across binary load

I would like to be able to set the Always One Selected Value flag on a field as a part of the load script, rather than having to configure only in the front end. An alternative that would work for my environment is to be able to have that configuration move as a part of a binary load.

I am responsible for setting up data models that will be used across multiple apps that other people will be developing (they do a binary load of my data model and then build sheets). In my data model there are some fields where the appropriate usage of them is to set "Always One Selected Value", however this has to then be set by the people who are developing front ends in every app they create.

If this configuration goes with a binary load then by default those other developers get the setting, and if it can be configured as a part of the script I can share a sub with them that they can run in their script after the binary load to achieve the same result (and very simple to audit that it is being done).

Tags (2)
11 Comments
Vegar
Partner
Partner

Even QlikView would benefit from a more explicit way of stating which fields should be always one selected or not. 

kuba_michalik
Partner
Partner

I'm all for being able to control it via script and it would be very useful in at least two cases:

1. If you have any kind of version control like Git or SVN. Unfortunately, currently only out of the box option is to store binary .qvf file after every change, but of course it makes zero sense to store it together with the data. However, if you export QVF without data it will wipe any information about Always One Selected, so you need to manually prepare minimal viable data for every time you want to store it in version control.

2. Auditing existing app with less then stellar documentation. Good luck going through 1500 fields and trying to find which has Always One Selected enabled.

This is a setting which can fundamentally change app behavior, and so it should be as easy to manage as possible, not buried in settings that can only be manually configured.

Patric_Nordstrom
Employee
Employee

Thank you for your feedback on ways to improve our product. While this is something we understand would be useful, it's not on the short-term roadmap. Please continue to show your support for this idea.

Thanks,

Patric

Status changed to: Open - Collecting Feedback
Gard_H
Partner
Partner

Upvoting this:

My reason is mainly because the "Always one selected" option is reset if the field is not loaded for some reason and the app is saved. Makes for unnecessary extra work, and can make dashboards crash. 

Lech_Miszkiewicz

Very much needed feature.

It wil allow for so much needed simplification of the app setups by:

  • one source of control for always one selected value fields
  • much easier setup of always one selected for fields which are hidden - those always require 2 steps in Qlik Sense:
    • load field and configure "always one selected" value
    • reload app and hide field
  • will allow to export apps without data and retain setting once app is reloaded with data again

This was always a big gap / inconvenience  which could be a great help once implemented.

Patric_Nordstrom
Employee
Employee

Fyi, it possible to change the field type and set the value with a script:

Script that sets the default value for the field and after that set the field to “Always one selected value”. 
https://help.qlik.com/en-US/sense-developer/latest/Subsystems/EngineAPI/Content/Sense_EngineAPI/Work...
Enigma: https://qlik.dev/apis/json-rpc/qix/field#%23%2Fentries%2FField%2Fentries%2FSetNxProperties

Lech_Miszkiewicz

Hi @Patric_Nordstrom 

By saying that it is possible to do this with script, did you meand Qlik Sense data load script? Obviously my previous comment was going towards the concept where we use only Qlik supported tools (for example Qlik Web connector or Qlik Rest Connector or other??) to that. 

I am not interested in solutions which require 3rd party as they are useless when it comes to support.

I have general understanding how API works and I was never able to achieve setting always one selected, simply because I could not get it working within Qlik load script. I hope I was wrong and this could be achieved, however is it really? If yes - how?

If you can share light how would you do this within the qlik data load script it would be much appreciated. 

thanks!

 

Patric_Nordstrom
Employee
Employee

@Lech_Miszkiewicz  sorry, I meant a enigma script, it's not related to the load script.

Here's a script that sets a dimension to single selection and set the default value. This runs with Qlik Sense Desktop and an App: Only.qvf with ctrl-00 script, changing the Dim1 dimension. Install enigma and docs: https://github.com/qlik-oss/enigma.js/

const enigma = require('enigma.js');
const WebSocket = require('ws');
const schema = require('enigma.js/schemas/12.20.0.json');

const session = enigma.create({
  schema,
  url: 'ws://localhost:9076/app/engineData',
  createSocket: url => new WebSocket(url),
});

session.open().then(global => {
	global.openDoc('Only.qvf').then( app =>{
		app.getField('Dim1').then( field =>{
			var selected=[ { "qText": "C","qIsNumeric": false,"qNumber": 0} ]
			field.selectValues(selected).then( () => 
				field.setNxProperties({
					"qProperties": { "qOneAndOnlyOne": true }
				})
			)
			.then(() => app.doSave())
			.then(() => session.close())
		})
	})
})

 

 

 

 

Lech_Miszkiewicz

Thanks @Patric_Nordstrom 

I will give it a go just to see how it goes...

Is the enigma library you are refering to fully supported by Qlik support in case we have issues with it?

In other words can I log a ticket via Qlik support if something does not work with it and that ticket will not be closed with comment that it is not a Qlik product?

As you know as partners we dont want to be left alone when that library goes out of date or will stop working with new version of Qlik Sense.