How do i compare data between two arrays saved in separate variables and extract the unique data

Options

So basically I'm running two different api calls one to google calendar and another to Microsoft events and saving each of the these events results in their own variables, so i want to compare the results saved in those variables between each other and save the unique ones in a variable. This is my current set up

the data I'm trying to compare is in the google events and Microsoft events variable, then I'm trying to find all the elements where the title matches. but i keep getting this error

even thought the google variable contains this data

any idea on how to approach this?

Best Answer

  • arturosanz
    arturosanz Member ✭✭
    edited September 2023 Answer ✓
    Options

    @iconic are you totally sure that all google_events items have the summary key? Can you check in the debugger which specific google_events item threw the error?

    My suggestion is to avoid using the dot notation whenever you are not completely sure about the presence of an object key. Better apply the filter get to $this that allows you to set any default value you like in case the summary key is missing, instead of throwing an error.

Answers