Hi,
I’m trying to show a parameter only if some ‘x’ field is available in the response when the first parameter is loaded. I know we can apply condition via displayOptions -> show
, but the key and values needs to be the name of some other parameter, otherwise it throws following error Could not resolve parameter depenencies. Max itterations got reached
. But in my case the condition I want to display the parameter on, is not the name of the another param, it’s some field which will be available according to the selected value.
my goal is to display List of DB
paramter only if the the selected field’s value carry the field ds_connector_type
as `cloud from the first parameter, something like this:
{
displayName: 'DataSource Name',
name: 'datasource',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getDatasources',
},
required: true,
default: '',
description: ''
},
{
displayName: ‘List of DB',
name: 'databases',
type: 'options',
typeOptions: {
loadOptionsDependsOn: ['datasource'],
loadOptionsMethod: 'getDatabases',
},
displayOptions: {
show: {
ds_connector_type: [
'cloud'
],
},
},
required: false,
default: '',
description: 'Database names configured on Privaci Datasources page.'
},
The method getDatasources
will make an api call and load the names in the dropdown, if the selected field’s value carry ds_connector_type
as cloud
, only then I want to display the parameter ‘List of DB’ else not.
Code for getDatasources :
async getDatasources(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const res = await getDatasourceList.call(this);
for (const item of res) {
const dsObj = {
id: item.id,
name: item.name,
ds_connector_type: item.ds_connector_type,
onprem_connector: item.onprem_connector,
cloud_connector: item.cloud_connector,
};
returnData.push({
name: item.name,
value: JSON.stringify(dsObj),
});
}
return returnData;
},
Kindly let me know if what I’m trying to achieve is even possible ? if yes then how can I achieve this ?
Thank you.