HI all , hope you can help , i have the following transformer getting data out of an api call , unfortunately the api call is returning data that has epxired and i want to filter out
it relates to contact information so if we make a change to the contact , it ends the current record and creates a new one, i only want to show the records that are active
the transformer i'm using is
const data = {{FindContacts.data}}
// Initialize an empty array to hold final data
let finalData = ;
// Loop through each key in the data object
Object.keys(data).forEach(key => {
// Retrieve specific data points for each instance and assign to variables
let Lastname = data[key]["a:LastName"][0];
let Firstname = data[key]["a:FirstName"][0];
let Dob = data[key]["a:DateOfBirth"][0];
let Contactid = data[key]["a:ContactId"][0]
let effectivetodate =data[key]["EffectiveToDate"]
// Create a new object containing all relevant data points
let newObj = {
'Lastname': Lastname,
'Firstname': Firstname,
'Dob' : Dob,
'ContactId': Contactid,
'effectivetodate' : effectivetodate
};
// Add new object to the finalData array
finalData.push(newObj);
});
// Log finalData to the console and return it
console.log(finalData);
the record i want to show looks like
any advice on how to best achieve this is most welcome.