Hello,
I have two collections I wish to compare, one grabs the contents from a SharePoint list (colReturnList) and the other a Power BI query (colReturnData) received through Power Automate. The values within the PowerBI collection received from the ParseJSON are Text.
The code I'm using to compare is:
ForAll(colReturnList,
If(
IsBlank(LookUp(colReturnData, 'Asset Tag' = ThisRecord.'Asset Tag')),
Patch(colReturnList, ThisRecord, {'File Status': "Returned" })
))
It tells me that the 'Asset Tag' from the SharePoint collection is a Record and the 'Asset Tag' in the PowerBI collection is Text and cannot be compared. I saw from other posts to change the record value to 'Asset Tag'.Value, but that doesn't work. What did end up working, was creating a new collection where a column was added as text.
ClearCollect(colReturnList,
AddColumns(colReturn,
AssetText,
Text(ThisRecord.'Asset Tag')
)
)
It then allowed me to do the lookup in the original code after I changed 'Asset Tag' to AssetText.
ForAll(colReturnList,
If(
IsBlank(LookUp(colReturnData, AssetText = ThisRecord.'Asset Tag')),
Patch(colReturnList, ThisRecord, {'File Status': "Returned" })
))
I needed to do a compare on the other list, so I tried a ForAll() on colReturnData, but it doesn't work. It won't allow me to do the LookUp and this is where I'm stuck. I don't understand why it worked the one way, but it won't work when doing the LookUp in the opposite direction.
ForAll(colReturnData,
If(
IsBlank(LookUp(colReturnList, 'Asset Tag' = ThisRecord.AssetText)),
Patch(colReturnData, ThisRecord, {'File Status': "New" })
))
I tried the same workaround of adding an AssetText column to colReturnData, I was then doing a LookUp between AssetText and AssetText, but still says the records don't match.
Any help is appreciated!