I am working on a project involving email communication analysis, where I extract labels from a stream of emails, process them, and queue different data types. I need to assign the last label’s name from each email to a variable Category. However, if no labels are present, Category should be assigned “null”.
Here is the expression I’m using for assignment:
If(in_Listofcategory(0).name.Last().ToString IsNot Nothing, in_Listofcategory(0).name.Last().ToString, “null”)
Issues Encountered:
The assignment does not work correctly; Category sometimes does not receive any value, especially when the labels are missing from the emails.
The process should assign “null” to Category when no labels data is present and the last label’s name when it is present.
Question:
Can anyone suggest how to modify the expression to reliably assign “null” when no labels are present and the last label’s name otherwise? I suspect the issue might be with how I’m handling potentially empty or Nothing values.
Additional Context:
The labels are dynamically extracted from each email.
The in_Listofcategory is a list populated with these labels.
Any suggestions or corrections to my approach would be greatly appreciated!
i amtrying i use this query like this because in_ListCategory cannot be indexed only Labels can be indexed
If(in_Listcategory.Count>0,Enumerable.LastOrDefault(in_Listcategory…Labels(0).name,“Null”),“Null”)