on 2023 Aug 31 12:29 PM
hi
what is the use case for "Application.getfiledatasource" ?
when to use the filedatasource?
what exactly is the different between the datasourc and the filedatssource object?
br Oliver
Request clarification before answering.
Hi @oliver_raths,
I know your question ist quite old and you surely have found a solution. But since I just stumbled upon this discussion and for everyone else who may find this discussion, I´d like to add the following:
You must use the ID of the model, not the technical name or description. The ID will look like "Cu4o1l0eqjiphse1tosogajc2u".
You can look up the ID in the model "RESOURCE", which is available on every SAC. Please filter the "Object Name" to the technical name of your model (like your "testquery") and output the "Object ID". This is the ID you want to use in Application.getfiledatasource.
So the coding in your example will look like:
ds = getFiledatasource("Cu4o1l0eqjiphse1tosogajc2u");
ds.setVariableValue("0I_FPER",{from:time_range_from_array[1],to:time_range_to_array[1]});Best regards,
Denis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @DenisT ,
Thanks for your solution!
However, I still don't understand where the modelId is obtained from. My understanding is that it should be the technical name of a model taken from the Data Source to serve as the modelId. But in the logs, the information indicates an incorrect parameter setting, so I'm unclear about what's happening. Do you have more specific details? Looking forward to your response!
Best Regards,
Wenjun
Hi @sv7en,
please note that you have:
The first ones are the ones you usually see if you e.g. use the files browser in SAC. The model ID you can e.g. get by:
Let´s dive into the coding option and let´s assume you have a Table named "P1_TAB_Demo", connected to a model (in my case with the name "TITECON_Demo_Model"). Now create a button with an onClick Script event:
console.log (P1_TAB_Demo.getDataSource().getInfo());This will result can be shown in the browser developer tools console (F12):
So in my Example the model ID output is "t.8:Ca0dju0b3o8jdb3sh78rh61a35r", where "t.8" is the Content Namespace of the SAC tenant, which is not relevant, so the model ID you should use in your further coding is only "Ca0dju0b3o8jdb3sh78rh61a35r".
Just hit me directly, if you need any further assistance.
Best regards,
Denis
oliver_raths
getFileDataSource(modelId: string): FileDataSourceReturns the data source of related modelId. No widget tagging required
lets say you have multiple widgets like Table1 , Chart 1 etc. ( same data source) and want to perform some logic for all of them
getDataSource(): DataSource
You would need a widget to tag this datasource.
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Nikhil,
i tried the following =>
4 charts bases on the same datasource/query ("testquery")
chart1; chart2; chart3; chart4
************************************************
ds = getFiledatasource("testquery");
ds.setVariableValue("0I_FPER",{from:time_range_from_array[1],to:time_range_to_array[1]});
=> no reaction in the 4 charts for the new variable setting
****************************************
ds = chart1.getdatasource
ds.setVariableValue("0I_FPER",{from:time_range_from_array[1],to:time_range_to_array[1]});
=> all 4 charts refreshes the data for the new variable setting
****************************************
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.