on 06-20-2021 4:11 AM
Does anyone know how to pass a value selection from an application to a composite. My main application has a listbox. Application also has a composite that houses a chart. When the user makes selection(s) in the listbox, it is supposed to filter the chart in the composite. Is there a way to pass the value(s) selected from the listbox in the application and pass them to the chart in the composite to filter chart data?
I stored the value selected from the listbox in a global variable but hasn't been able to find a way to pass it to the chart in composite. Currently looking into datasource alias property within composite but not sure if it can achieve the above requirement?
Using a DataSource in both the application and a composite usually works this way: You define a data-source in the main application and pass it to the composite. Then you can manipulate it from the main application’s code (e.g. setFilter), and the components in the composite get updated if they are bound to this data-source.
This data source sharing works via the following steps:
1) In the composite, define an Interface Property of type “DataSourceAlias”
2) In the composite, you can then assign this DataSourceAlias to a component of the composite, e.g. a Chart.
3) In the application you can assign your application’s DataSource to the the DataSourceAlias of the composite.
From that point on, all modifocations in the DataSource of the application will also be reflected in the DataSource of the Composite.
Best,
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Martin,
Thanks for explaining how a data source in composite can be controlled from the host application using datasource alias property.
However, I am unable to replicate the same for a listbox that is populated via java script getMemberList method.
So I have a listbox (LB_Main_App) in the main application. Listbox is populated via getmemberlist java script method as below:
LB_Main_App.setItems(DS_1.getMemberList("_WIvwdfdfffffW9OaTTA", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT,550));
The same listbox is also in the composite (LB_Cmp). I need to populate LB_Cmp with the same dimension as LB_Main_App.
Here are the steps I took within composite:
The "Unhandled even loop exception" is most likely a bug in Lumira Designer and I encourage you to open a bug ticket.
The reason why such an error arises, is that at design-time, the component does not yet know which data-source will be assigned at runtime. Therefore, it is not possible to pick a dimension at runtime.
As a workaround you can fill the listbox with a line of scripting in the component. Each component has an event “On Initialization”. In this event, you can simply add a similar call, which you already used to fill the listbox of the application:
LB_Cmp.setItems(DS_cmp.getMemberList("_WIvwdfdfffffW9OaTTA", MemberPresentation.INTERNAL_KEY, MemberDisplay.TEXT,550));
Best regards
Martin
Hi!
You could create an interface function (setter) in the composite, that can be triggered from the main application in script. Here you can pass in the value from your combobox and apply the according filter to your chart in the composite.
Regards,
Harald
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do have a function in composite that gets triggered from the main application. However, I'm unable to expose any property of composite to the main application. Interface function of the composite is the only thing that gets exposed to the main application. Below is the setup at a high level:
Main Application:
ListBox (On Select): GV_LB =listBox.getSelectedValue(); //storing selected value in a global variable.
Launch_Composite_Button (On Select): This script from main application calls an interface function (fnc_cmp) of composite.
Composite:
fnc_cmp: here I am unable to access GV_LB from within the composite.
I tried creating a datasource alias property within composite but unable to bind it with original data source from main application.
Hi,
interface functions can have parameters. The easiest way would be to pass the value of GV_LB as parameter to fnc_cmp.
Best,
Martin
Was able to pass the values from the host application to the composite via parameters. Thanks for the suggestion.
In addition to the setter function mentioned by Harald, you would typically expose the data-source of the chart in the composite as a “Interface Property” of the composite.
The data-source would then be owned by the application (and not the composite). In the application you can then make calls like “setFilter” to the data-source. The Chart inside the composite, which is bound to that data-source, will then automatically reflect that changed filter.
Maybe that helps.
Best,
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.