Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
AmCh
Creator
Creator

To add chart expressions automatically

Hello all,

I have customised my chart with the following properties:

AmCh_0-1613045960718.png

My goal: Expressions (with their condition, label and definition -variable-) can be added automatically on each script load.

//condition=GetFieldSelections(Systems)='x' and GetFieldSelections([Maintenance costs])='Corrective maintenance costs'

My variables (e.g. CM_Annual_x) are already automatically generated on each script load. 

 

Can someone help me?

Many thanks in advance.

Labels (3)
7 Replies
edwin
Master II
Master II

i dont think loading scripts will add expressions in charts.  the only case ive seen where data in a way drives the number of expressions is in a pivot.  maybe you can remodel your data  and use pivot in your chart

AmCh
Creator
Creator
Author

What about an action button that adds a new variable (that saves the expression)?
Do you have an alternative other than loading scripts to add expressions to charts?

Many thanks in advance.

edwin
Master II
Master II

Expressions are manually added to a chart at dev time not at run time. 

what is the user experience that drives this requirement?  if you articulate the pure business requirement maybe that will help others understand what the underlying objective is

AmCh
Creator
Creator
Author

Since the amount of data is always changing, I am looking for a way to make the developer's task more efficient, because I am talking about adding a large amount of expressions to the chart in a daily basis.

It has nothing with the user experience.

marcus_sommer

It's not possible to add/change/remove UI objects or parts of it with the script. But it could be done with macros. Another possibility would be to add and/or manipulate the content of the prj-folder.

Whereby I wouldn't recommend it because it wouldn't make anything easier or more efficient else it goes definitely in the opposite direction. And this is mainly independent of the way of doing it (assuming that you would be quite experienced in the methods I mentioned because otherwise you would need some time to learn it and a more or less part of trial & error to get a stable implementation) because the most expensive part is the needed administrative overhead.

If you want to simplify the developer work it would be better to rethink the datamodel and the usability.

- Marcus

AmCh
Creator
Creator
Author

In summary:,there are two ways to solve this/modify UI objects:

1. with macros. Can you give me an introduction on how to do this?

2. rethinking the data model: what do you concretely mean by 'rethinking' in this case?

 

Thank you in advance.

marcus_sommer

To start with macros take a look on the APIGuide.qvw within your install-folder by automation which gives you a good overview about the object-model and has also many examples and explanations.

Usually a finalized application needs not much attention from the developer - there will be occasionally some new/changed requirements which may require some adjustments on the application. So accessing an application maybe 10 times in a year for changes which in 8 times are a matter of a few minutes don't justify such large overhead with so much more complexity.

If your application needs regularly adjustments it hints on an unsuitable datamodel - for example if it contains crosstable-structures in which each new date or new product creates a new field or something similar. In this case it would be really a never ending story ... Better would in this case be to transform the crosstable into a "normal" table.

- Marcus