Hello, I have the following formula that does not give any error but does not bring me the records that I must return
I'm sure that's how the owner gets it and I know it because it works in another gallery
and the filter Approval.Status = 'Status (Approvals)'. Activate The status is fine because in the same way it is already in a gallery and works correctly
but when I want to do this in a single formula, it doesn't return the records:
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Approval.Status = 'Status (Approvals)'.Active, Owner_Email = User().Email), "createdon", Descending)
Solved! Go to Solution.
Hi @octaking
I got this working
So if you actually look at the Approval Request entity - the lookup to Approval is empty
There is no data in there
hence
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Approval.Status = 'Status (Approvals)'.Active, Lower(Owner_Email) = Lower(User().Email)), "createdon", Descending)
will give no data
whereas
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Lower(Owner_Email) = Lower(User().Email)), "createdon", Descending
will return results
So now what has to be done is this,
first get a collection of all active (running) approvals from the Approval entity
ClearCollect(colActiveApprovals,Filter(Approvals, Status = 'Status (Approvals)'.Active))
You can do this on page visisble or button click
then for your gallery run the following :
SortByColumns( Filter( 'Approval Requests', 'Approval Id Index' in colActiveApprovals.Approval && AsType(Owner,[@Users] ).'User Name' = User().Email ), "createdon", Descending)
This will give you the results you are looking for
I did notice all items in Approval Request have status Active - so im guessing that is just a default value set which never changes and does not reflect the true status of the approval
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @octaking
as a test
add AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal') to a collection
ClearCollect(coltemp, AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'))
and check and see the value format in Owner_Email
I have a feeling it does not match the User().Email format
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hello @RezaDorrani ,
thanks for answering
I did the test you indicated and the format of Owner_Email is as follows:
Hi @octaking
try
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Approval.Status = 'Status (Approvals)'.Active, Lower(Owner_Email) = Lower(User().Email)), "createdon", Descending)
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @RezaDorrani
still without returning records
Look, this is my other Approval gallery and it works well, it brings me the pending requests from the owner.
Hi @octaking
only doffernece I see is the Status part of the formula
try changing that also and check
Hi @RezaDorrani
Look at this filter in a view of the entity if it returns the slopes:
Owner = CurrentUser and Approva.Status = Active
The result = Pending approvals per current user:
It is strange that the formula does not work
since this has the same logic
Yes, I changed the status of Active to zero but it still gives the same result
Hi @octaking
I got this working
So if you actually look at the Approval Request entity - the lookup to Approval is empty
There is no data in there
hence
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Approval.Status = 'Status (Approvals)'.Active, Lower(Owner_Email) = Lower(User().Email)), "createdon", Descending)
will give no data
whereas
SortByColumns( Filter( AddColumns('Approval Requests', "Owner_Email", AsType(Owner, Usuarios).'Correo electrónico principal'), Lower(Owner_Email) = Lower(User().Email)), "createdon", Descending
will return results
So now what has to be done is this,
first get a collection of all active (running) approvals from the Approval entity
ClearCollect(colActiveApprovals,Filter(Approvals, Status = 'Status (Approvals)'.Active))
You can do this on page visisble or button click
then for your gallery run the following :
SortByColumns( Filter( 'Approval Requests', 'Approval Id Index' in colActiveApprovals.Approval && AsType(Owner,[@Users] ).'User Name' = User().Email ), "createdon", Descending)
This will give you the results you are looking for
I did notice all items in Approval Request have status Active - so im guessing that is just a default value set which never changes and does not reflect the true status of the approval
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
User | Count |
---|---|
183 | |
123 | |
88 | |
45 | |
42 |
User | Count |
---|---|
250 | |
160 | |
126 | |
78 | |
73 |