I am building an object to pass into a chartjs line chart and I'm looking to see if I can make it a little more dynamic.
Right now I have the following when building the data object, and it works a treat:
var inboundEvent = {
time: $A.localizationService.formatDateTime(message.data.payload.CreatedDate, 'HH:mm'),
createdById: message.data.payload.CreatedById,
key: message.data.payload.key__c,
value: message.data.payload.value__c
}
//add the most recent event to the array
events.push(inboundEvent);
I want to create variables for key__c and value__c and then use the variable instead of the literal field name that is currently being used. The __c values are hardcoded field names coming off an event stream and i'd like to change it so that I could use the same code on a different event and pass the field names from that new event in dynamically.
This isn't (or doesn't seem like) a simple string concatenation..