Tree View Question

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Tree View Question

Post by Jhstephenson »

Back to some Tree View Questions...

I have a tree view of Employees Supervised that looks some like this...

Code: Select all

Employees Supervised by <<LoggedInEmployee>>

Mickey
	Donald
	Goofy
	Pluto
		Dewie
		Louie
Minnie
	Daisy 
	Hewie
Basically the Logged in Employee supervises Mickey who supervises Donald, Goofy, and Pluto. Pluto also supervises Dewie and Louie. Then Minnie supervises Daisy and Hewie.

This display and operates just fine.

I also have a record operation for each branch that takes me to that employee's main form. This works fine too.

I would like to have another record operation that runs a process for the employee branch selected that does a few things.

So, I create a process that has the Employee BO as the input. I want to find all EmployeeReview records associated with the employee selected and then show them in a query or do an update operation on them.

The question is how do I structure the Find Operation in the process?

I have tried the following:

FIND EmployeeReview WHERE EmployeeReview.Employee=Employee
DISPLAY EmployeeReviews
and

FIND EmployeeReview WHERE EmployeeReview.Employee=ThisEmployee
DISPLAY EmployeeReviews

In both cases I get the EmployeeReviews assigned to me, not the Employee on the selected tree branch.

I must be missing something in how this works, but I am not sure what.
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Tree View Question

Post by PointsWell »

FIND EmployeeReview WHERE EmployeeReview.Employee=ThisEmployee
DISPLAY EmployeeReviews
You are putting the ThisEmployee at the wrong level. The Find inside the Process should be:

Code: Select all

FIND EmployeeReview WHERE EmployeeReview.Employee=Employee
The button that starts the process should receive a BO as Input (Employee) and your process will show inputs as Employee this should be mapped to ThisEmployee
Input
Input
Screen Shot 2022-03-12 at 08.28.06.png (13.45 KiB) Viewed 1569 times
If you look at the logger before making this change you will probably see multiple Employee instances being passed to your process, the find takes one of those and in this instance it happens to be your Employee record instead of the chosen Employee
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Tree View Question

Post by Jhstephenson »

We have tried that before and we get an error that says...

Operation 'Review Reports' used in Presentation information in attribute EmployeesSupervised in the form section Supervision of form Main in the business object Employee uses business object 'ThisEmployee' which has not been found.
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Tree View Question

Post by PointsWell »

Jhstephenson wrote: Fri Mar 11, 2022 10:54 pm We have tried that before and we get an error that says...

Operation 'Review Reports' used in Presentation information in attribute EmployeesSupervised in the form section Supervision of form Main in the business object Employee uses business object 'ThisEmployee' which has not been found.
My bad, I was commenting from memory and my memory is failing.

On checking the example I had this issue with it seems like I have created a two step process that forks based on some personal criteria, this uses the format

Code: Select all

IF x=y THEN 
 ProcessName USING ThisEmployee
That may be an annoying work around. I am going to make a guess that there is an issue of the FIND and the BOs in context.

Another unsatisfactory work around might be to place the target BO.ID into a LIRU or LIRU.SessionVariables attribute and then do

Code: Select all

FIND EmployeeReview WHERE EmployeeReview.Employee.ID=LIRU.SessionVariable.EmpID
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Tree View Question

Post by Jhstephenson »

I tried putting the Employee.ID into a session variable, but had the same issue of knowing which Employee.ID it was actually putting into my session variable. Sometimes it worked and sometimes it didn't.
PointsWell
Posts: 1460
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Tree View Question

Post by PointsWell »

Having looked at your BO architecture you have an insurmountable problem

Employee has
Employee.psSupervisor
Employee.pmSupervised

Because the Query Tree layout is not available you have to use the Tree widget on a form.

The form by default has the Employee in context. The operation on the Supervised then brings another Employee into context. I don’t see how you would drop the initial Employee from context while bringing the desired one into context.

My only other suggestion is

Tree view calls process receives Employee as an input

Process then calls the real process with input of

ProcessName USING ThisEmployee

This would ensure that only one Employee was being passed but I am not sure that it would force the right Employee into context

@Support, this is another reason why Tree hierarchy for queries would be very helpful viewtopic.php?f=3&t=10981
Post Reply