09-08-2023 07:22 AM
I would like to use a jsonpath in an expression library, but I am unsure of the syntax with parameters.
custfield is a json array of custom field data and fieldname is a string
This is what I attempted:
{
customField: (custfield,fieldname) => jsonPath($, "custfield[*]").find(f=>f.FieldName==fieldname)
}
What should the syntax be?
09-13-2023 07:03 AM
Could you share the sample JSON and expected response ?
10-04-2023 09:02 AM - edited 10-04-2023 10:15 AM
Fieldname would be Lateral Size and the return would be 5 (what's found in the matching PickListItems to the Value found in that custom field). Below is what would be found in custfield.
[{
"CustomFieldId": "68f40528-4d63-6a70-60d6-0797407c53d7",
"CustomFieldLayoutControlType": 2,
"CustomFieldType": 5,
"FieldName": "LateralSize",
"FieldTip": "",
"DefaultValue": "",
"Label": "Lateral Size",
"Formula": "",
"IsRequired": true,
"IsActive": true,
"IsLabelSurpressed": false,
"AllowMultipleSelections": false,
"IsRequiredInCAP": true,
"PickListItems": [
{
"CustomFieldPickListItemID": "28bd8b11-dfd5-f514-a694-320be7078e59",
"Value": "5",
"Order": 1,
"Retire": false,
"IsMultiSelected": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
},
{
"CustomFieldPickListItemID": "2b58d501-5584-bfbb-a622-54778262cf3f",
"Value": "6",
"Order": 2,
"Retire": false,
"IsMultiSelected": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
}
],
"IsReadOnly": false,
"FieldType": 5,
"ControlType": 2,
"Value": "2b58d501-5584-bfbb-a622-54778262cf3f",
"DependentFormulas": [],
"FormulaFields": [],
"TotalWorksheetNumericValue": 0.0,
"IsWorksheet": false,
"ColumnHeaderName": "",
"CanWorksheetItemsWrite": true,
"WorksheetItems": [],
"CustomFieldTableRows": [],
"CustomFieldTableCellType": 0,
"CustomFieldTableRowNumber": 0,
"IsTableColumnEntry": false,
"IsTable": false,
"IsValidationSurpassed": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
},
{
"CustomFieldId": "09a0e02d-ae97-431e-74b6-4ea9ecdd742d",
"CustomFieldLayoutControlType": 1,
"CustomFieldType": 5,
"FieldName": "StreetofConnection",
"FieldTip": "",
"DefaultValue": "",
"Label": "Street of Connection",
"Formula": "",
"IsRequired": true,
"IsActive": true,
"IsLabelSurpressed": false,
"AllowMultipleSelections": false,
"IsRequiredInCAP": true,
"PickListItems": [],
"IsReadOnly": false,
"FieldType": 5,
"ControlType": 1,
"Value": "asdf",
"DependentFormulas": [],
"FormulaFields": [],
"TotalWorksheetNumericValue": 0.0,
"IsWorksheet": false,
"ColumnHeaderName": "",
"CanWorksheetItemsWrite": true,
"WorksheetItems": [],
"CustomFieldTableRows": [],
"CustomFieldTableCellType": 0,
"CustomFieldTableRowNumber": 0,
"IsTableColumnEntry": false,
"IsTable": false,
"IsValidationSurpassed": false,
"IsNew": false,
"IsDeleted": false,
"IsDirty": false,
"ClientId": null
}
]