Where to find Data Source ID for URL Parameter in Experience Builder?

455
5
03-01-2024 12:46 AM
GeeteshSingh07
Occasional Contributor II

Hi everyone,

In the following document, it is mentioned that <dsID> is Data Source ID: https://doc.arcgis.com/en/experience-builder/11.1/build-apps/url-parameters.htm#:~:text=Each%20data%....

We are referring this sample URL from the above document:
https://experience.arcgis.com/experience/<AppId>/?data_id=<dsID>:<selectedrecordID>

How & where to find this data source ID in experience Builder if we want to create a custom URL with parameters?

This datasource id looks like combination of "WebMap" item id & something else. How can I find entire data source ID?

Any help on this will really be appreciated.

Best, Geetesh

 

5 Replies
Shen_Zhang
Esri Contributor

Hi @GeeteshSingh07 

<dsID> can be found when you make a selection in the app at run time. Say you have an app that has a table in it. When you select a row in the table, you will be able to see the ?data_id=<dsID>:<selectedrecordID> appearing in your URL:

Screenshot 2024-03-01 at 17.09.47.png

In the example above, 'dataSource_2-2' is the data source ID, '%3A' is the encoded value of the colon, and '2 ' is the objectID of the selected record.

Any selections you make in the app will lead to adding the data_id in the URL - it does not have to be a selection in the table. However please note that URL parameters are added in preview and run time, but not in the builder.

Please let me know if you have any further questions!

 

Shen Zhang
0 Kudos
GeeteshSingh07
Occasional Contributor II

Hi @Shen_Zhang, thank you for the prompt response. 
I want to write a custom code for this URL, I am looking for a way  to find this "dataSource_2-2"? 

For example, we can see item id for a web map from item detail's page, app id from item detail's page...similarily, where to find this <dsID>?

 

0 Kudos
GeeteshSingh07
Occasional Contributor II

To explain more about the use case @Shen_Zhang, I am creating a custom widget in Experience Builder which incorporates the functionality from "Share" Widget from Web AppBuilder. Web AppBuilder Share Widget allows users to create dynamic URLs based on the parameters  listed in screenshot.

GeeteshSingh07_0-1709285841342.png

Now, we are not sure that where is this <dsID> stored so we can add it to our code that can be used to generate dynamic URL?

If we have to use itemID of web map, we know it's available in item details page. But where is <dsID> saved?

I hope this gives the idea for this requirement.

0 Kudos
YueyangLi
New Contributor II

Hi @GeeteshSingh07 ,

To get the data source ID, you can use the DataSourceManager.

 

import { DataSourceManager } from 'jimu-core'

// Return IDs of the main data sources that are used by widgets.
function getAllDataSourceIds () {
    return DataSourceManager.getInstance().getDataSourcesAsArray().filter(ds => ds.getMainDataSource().id === ds.id).map(ds => ds.id)
}

 

 

?data_id is currently still supported but will soon be deprecated. To select records by URL, use #data_s. https://doc.arcgis.com/en/experience-builder/latest/build-apps/url-parameters.htm .

GeeteshSingh07
Occasional Contributor II

Thank you @YueyangLi. I will try this out.

0 Kudos