I am struggling to access a specific property within an array of objects. My goal is to extract the "name" elements from the app catalog array, combine them with the names from the custom array apps.name, and assign the result to a new property in the questionnaire object called "appNames". I want to use this new property as a header in the ag-grid. However, I have been unsuccessful in achieving this and feel like I am overlooking something important.
Here is the payload I am working with:
{
"id": 1,
"firstName": "test",
"lastName": "customer",
"status": 1,
"accountType": "CUSTOMER",
"licenseType": "BASIC",
"questionnaire": {
"id": 6,
"companysize": "MICRO",
"industry": {
"id": 1,
"name": "Agriculture and Mining"
},
"language": "CZ",
"appCatalog": [
{
"appIdToSearch": 6,
"appNameDefault": "SECURITY PLUS"
},
{
"appIdToSearch": 121,
"appNameDefault": "New logo test CZ"
}
],
"customApps": [
{
"id": 16,
"name": "asd",
"enabled": false
},
{
"id": 49,
"name": "aaaaaa",
"enabled": false
}
]
}
}
and here is the code where I am trying to access other properties of the object:
{
headerName: 'First Name',
field: 'firstName',
sortable: true,
filter: true,
checkboxSelection: true,
editable: true,
resizable: true,
},
{
headerName: 'Last Name',
field: 'lastName',
sortable: true,
filter: true,
editable: true,
resizable: true,
},
{
headerName: 'Email',
field: 'email',
sortable: true,
filter: true,
editable: true,
resizable: true,
},
{
headerName: 'Phone',
field: 'phone',
sortable: true,
filter: true,
editable: true,
resizable: true
},
{
headerName: 'Employee Count',
field: 'questionnaire.companysize',
sortable: true,
filter: true,
editable: false,
resizable: true
},
{
headerName: 'Industry',
field: 'questionnaire.industry.name',
sortable: true,
filter: true,
editable: false,
resizable: true
},
{
headerName: 'Language Preference',
field: 'questionnaire.language',
sortable: true,
filter: true,
editable: false,
resizable: true,
},
{
headerName: 'Apps I am using',
field: 'AppNames',
sortable: true,
filter: true,
editable: false,
resizable: true
},
The last one, the "Apps I am using" field, is the one that is causing me trouble.
I am trying to populate this field with the values from appCatalog.appNameDefault and customApps.name, formatted as AppNames = appCatalog.appNameDefault + customApps.name. Unfortunately, I have been unable to make it work. Any assistance would be greatly appreciated!