Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to create new objects dynamically from load script?

Hi,

IS it possible to create objects (buttons, filters and etc.) dynamically from a load script? without using a macro?

Thanks,

Boris

13 Replies
francoiscave
Partner - Creator III
Partner - Creator III

Hi Boris,

Hi don't think so...

Have fun with QV,

François

Not applicable
Author

And if I do use a macro?

what is a appropriate way?

francoiscave
Partner - Creator III
Partner - Creator III

Boris,

Use the macro is never the best solution...

Macro could be unsafe and failed security.

Let's go to design your objects 😉

François

marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Boris,

It's not possible to do this without using a macro, but my question here would be why do you need to do this anyway?

It may be possible for you to create all the objects you need normally, and then if after your reload some are not needed, use conditional display conditions to hide those that are not required.

I think if you go down the route of dynamic object creation, you're entering a rabbit hole where your application may get unnecessarily complex.

Marcus

Not applicable
Author

We provide out customers a generic QV app with pre defined charts and filters which

reflect our generic product and thus its generic database structure which has predefined dimensions.

Usually different project have some customization in their project and they are adding more dimension to the database.

If they want this new dimension to be reflected in the same chart as other dimension we need it to be added dynamically when they add it to their database.

as most of the users are not QV developers we try to deliver a BI solution which won't require further developments.

Anonymous
Not applicable
Author

Boris,

Adding dimensions to a database doesn't guarantee that they are added in the QV application, unless the script is like

SELECT * FROM table;

And, using * is not a good idea for many reasons.  So, the must be somebody who modifies QV script.  And if you allow to modify script, it is much safer to allow them to modify front end objects.

Am I missing something?

Regards.

Michael

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You cannot create objects in the load script even using a macro. Creating or manipulating objects using the API requires the ActiveDocument object which does not exist during script execution.

You can do significant "programmatic" customization by using variables and data references in your objects. The variables and data can be set by the script through logic and data loaded from external configuration files. As a trivial example, consider setting a "vCompanyName" variable that is used in Headings on sheets. Variables and data can be used to configure the visibility of objects as well as the details of the expressions and dimensions used in those objects.

As a more pure programming approach, you can manipulate the files in the -prj directory to create and modify objects.

-Rob

http://masterssummit.com

http://robwunderlich.com

Not applicable
Author

Yes, the end user is a marketing/business user, he is not a QV developer, yet alone he is not scripting.

I'll add and say that he, as a user, doesn't have access to the QV server itslef, only to the Web application access point.

Each our product major version is accompanied with QV generic modules for this version.

If we allow each project to add UI changes and scripts by its own we won't be able to deliver changes, big ones or incremental.

francoiscave
Partner - Creator III
Partner - Creator III

Boris,

Have you need some more help ?

If not, can you mark an answer as Correct or helpful to close this thread.

Thanks,

François