Hello All,
i have two aggreagates, named "Name List 1" and "Name List 2".
I want to check if all values of one column(named Surname) of Name List 1 , if exists in Name List 2.
Any advise or suggestion?
Hi George,
Sorry, I did a little mistake in binding the expression value within the TableRecords, Please change the expression values accordingly...
Surname List1 Column
Table.List.Current.Surname
ExistsinList2 Column
Table.List.Current.IsExists
Sorry for the mistake (PFA).
Regards,
Benjith Sam
Hey George,
The easiest way may be to actually use a With or Without join in your aggregate. You can put your filters for "Name List 2" in the join condition, and your filters for "Name List 1" in the actual filters, and then check "Name List 2" if it is null. With a With or Without join, you would get your "Name List 1" items that do not have a matching "Name List 2" item.
For example:
I joined Names to itself on the Surname field, and then also any other filters I want against the second list. In this case, I want to find all Surnames that have an Active record but no Inactive record (I know the example doesn't make much sense, but bear with me):
The full data:
My aggregate:
Then in Filters, I set my filters for the first list and the null check:
Does that make sense? Alternatively you can use a bunch of for each loops
Hi, friend.
The best way to work with list is ufosing list commands. ListAny must solve your issue.
If not, iterate List1 and List2 with a For looping, like ForEach item in List1, ForEach List2 item etc.
As you mentioned that you want to compare two Aggregates (not an Entity) i.e. List of Records as mentioned below...
i have two aggregates, named "Name List 1" and "Name List 2".
The approach which passed my mind is framed out below...
1) Loop through the NameList1 using ForEach Loop action flow element
2) In every cycle/iteration, check whether the current NameList1 record Surname attribute value is present/exists in NameList2, using the ListIndexOf server action
3) If the ListIndexOf action returns -1 as output value in any of the iteration then, it means that the current NameList1 Surname is not present in the NameList2
4) Define your logic in the False branch of IF i.e. you can introduce a flag variable etc..
Hope this helps you.
Benjith Sam wrote:
thank you All for your reply.
@Benjith can you share the syntax of counter increasment ? Also, explain the usage of it.
You are welcome :)
I included the counter increment assignment node (logic), is just to get the total count value of Surname of NameList1 which does not exists in NameList2. Instead of the defined counter logic you can add your own required logic in that space.
Hope this helps you!
Many thanks.
But i confused withe the ListIndexof condition. You write
Surname=NameList1.Current.Surname
The target is to check if the Surname of List 1 exists in List 2. Can you clarify?
George wrote:
ListIndexOf is one of the pre-defined System Module, List Server Action
Description: Returns the position of the first element of the List parameter that satisfies the given condition, or -1 if no element satisfying the condition was found.
ListIndexOf Server action requires two inputs (for more info) as mentioned below:
1) List - The list that contains the elements to which to apply the condition.
2) Filter condition - The boolean expression to check for on each element of the list.
SyntaxEditor Code Snippet
Surname = NameList1.Current.Surname
The above mentioned Boolean expression checks:
Surname (attribute value of NameList2) = NameList1.Current.Surname (attribute value of NameList1)
Thank for your reply. Can you help me with the attachment example oml? where is my mistake?
As you see the table return yes to all results which is wrong
The correct is
Mitsiou No
Papadopoulou Yes
Smith No
George Mitsiou wrote:
The passed Boolean expression is incorrect because you where matching:
a Boolean attribute value with a Text attribute value
Correction in Entity Definition: The Name_List_2 Entity - List_2_Surname attribute data type is set as Boolean which should be changed to Text data type
PFA - Includes the updated .oml solution file.
Hello Benjith
hank for your reply. Can you help me with the attachment example oml? where is my mistake?
PFA - Updated the .oml Solution file with some code changes as per your requirement.
Thank you very much for your reply but the table results are not correct
Can you recheck?
Thanks you very much for your support!
You are Welcome George :)
One thing I want to mention considering the solution - As far as possible, we must avoid introducing any iterative/loop kind of logic in the Screen/webblock preparation action flow because it can be a reason for delaying the screen/webblock rendering activities.
Glad I could be of help!