Only show remaining that weren't picked previously

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Only show remaining that weren't picked previously

Post by numberz »

Hi,
This is probably entry level but I'm restarting my journey with AwareIM and need to get this straight.

So, imagine that I have a BO called Job.
I also have a BO called Contractor.

In Job I created a ps_Contractors.

Suppose I add 3 of the 10 Contractors that I have in my Contractor list, to my Job.

If I want to add more Contractors to same Job later, I only want to see the Contractors that I haven't added yet.

As it is now, each time I go to add another Contractor from list to my Job, it shows all of the Contractors, including the ones that I had already chosen.
TIA
Regards and thanks,
Harry Carter
rocketman
Posts: 1239
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Re: Only show remaining that weren't picked previously

Post by rocketman »

PICK FROM Contractor WHERE Contractor NOT(IN Job.Ps_Contractors)

INSERT Contractor IN Job.ps_Contractors
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
rocketman
Posts: 1239
Joined: Fri Jan 02, 2009 11:22 pm
Location: Preston UK
Contact:

Re: Only show remaining that weren't picked previously

Post by rocketman »

Or it could be WHERE NOT(Contractor in ….
Rocketman

V8.7 Developer Edition. Server 2016 Standard edition. MySql 5.5
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Only show remaining that weren't picked previously

Post by PointsWell »

Negated participation in a list is a known issue.

The solution is

Code: Select all

FIND Contractor WHERE COUNT Contractor WHERE( Contractor IN Job.pm_Contractor ) = 0 
So, imagine that I have a BO called Job.
I also have a BO called Contractor.

In Job I created a ps_Contractors.

Suppose I add 3 of the 10 Contractors that I have in my Contractor list, to my Job.
I'm guessing that your Job.psContractor is a multiple and so pmContractor

If I can make a suggestion, just using a peer multiple relationship to Contractor will only give you a binary state for the Contractor, i.e. they are on a job or are not on a job. Without knowing anything about your app, if you want to be more involved in how the Contractor participates on a job, e.g. when they were assigned, when they were removed, their starting date/time ending date/time, rate etc. then you probably want to have a full on BO relationship e.g. JobContractor with an JobContractor.obJob and Job.omJobContractor.
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Only show remaining that weren't picked previously

Post by numberz »

PointsWell wrote: Fri Feb 10, 2023 10:28 pm Negated participation in a list is a known issue.

The solution is

Code: Select all

FIND Contractor WHERE COUNT Contractor WHERE( Contractor IN Job.pm_Contractor ) = 0 
So, imagine that I have a BO called Job.
I also have a BO called Contractor.

In Job I created a ps_Contractors.

Suppose I add 3 of the 10 Contractors that I have in my Contractor list, to my Job.
I'm guessing that your Job.psContractor is a multiple and so pmContractor

If I can make a suggestion, just using a peer multiple relationship to Contractor will only give you a binary state for the Contractor, i.e. they are on a job or are not on a job. Without knowing anything about your app, if you want to be more involved in how the Contractor participates on a job, e.g. when they were assigned, when they were removed, their starting date/time ending date/time, rate etc. then you probably want to have a full on BO relationship e.g. JobContractor with an JobContractor.obJob and Job.omJobContractor.
Thanks Pointswell... but how do I pull from Contractor?
Regards and thanks,
Harry Carter
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Only show remaining that weren't picked previously

Post by PointsWell »

numberz wrote: Fri Feb 10, 2023 11:54 pm
Thanks Pointswell... but how do I pull from Contractor?
For which bit?
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Only show remaining that weren't picked previously

Post by numberz »

PointsWell wrote: Sat Feb 11, 2023 12:00 am
numberz wrote: Fri Feb 10, 2023 11:54 pm
Thanks Pointswell... but how do I pull from Contractor?
For which bit?
Well, so I do as you state but the choices need to come from a BO called Contractor because that will be the master list
JobContractors for Job need to come from a list of Contractors that are always available.
Regards and thanks,
Harry Carter
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Only show remaining that weren't picked previously

Post by PointsWell »

numberz wrote: Sat Feb 11, 2023 12:15 am
Well, so I do as you state but the choices need to come from a BO called Contractor because that will be the master list
JobContractors for Job need to come from a list of Contractors that are always available.
The suggested approach would add another grid to the Job BO.

For example
JobContractor would need
  • psContractor - Contractor
  • DateStart - Date
  • DateEnd - Date
  • Rate - Number
When adding the JobContractor to Job.omJobContractor use a custom implementation using whatever form you've designed for this purpose and passing in the Job as an input

Code: Select all

ENTER NEW JobContractor WITH JobContractor.obJob=Job
You'd then make JobContractor.psContractor filter as

Code: Select all

FIND Contractor WHERE Count JobContractor WHERE (JobContractor.obJob=Job AND Contractor=JobContractor.psContractor)=0
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Only show remaining that weren't picked previously

Post by numberz »

PointsWell wrote: Sat Feb 11, 2023 12:34 am
numberz wrote: Sat Feb 11, 2023 12:15 am
Well, so I do as you state but the choices need to come from a BO called Contractor because that will be the master list
JobContractors for Job need to come from a list of Contractors that are always available.
The suggested approach would add another grid to the Job BO.

For example
JobContractor would need
  • psContractor - Contractor
  • DateStart - Date
  • DateEnd - Date
  • Rate - Number
When adding the JobContractor to Job.omJobContractor use a custom implementation using whatever form you've designed for this purpose and passing in the Job as an input

Code: Select all

ENTER NEW JobContractor WITH JobContractor.obJob=Job
You'd then make JobContractor.psContractor filter as

Code: Select all

FIND Contractor WHERE Count JobContractor WHERE (JobContractor.obJob=Job AND Contractor=JobContractor.psContractor)=0
Getting there but have no idea what the "CODE: SELECT ALL" means and where I would enter that. Are you referring to a rule?

I am about as green on this as one can get, lol. :)
TIA
Regards and thanks,
Harry Carter
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Only show remaining that weren't picked previously

Post by PointsWell »

Code Select All is the forum, if you press that you can then copy the code in the code block. But I don't think my code snippets will be that useful.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Only show remaining that weren't picked previously

Post by tford »

Does this help?

https://www.awareim.com/forum/viewtopic ... 674#p45674

A blast form the past. 11 years ago.
Tom - V8.8 build 3137 - MySql / PostGres
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Only show remaining that weren't picked previously

Post by numberz »

HI tford,
I'm not sure.

A better visual:

On left menu, I have General Contractors. Let's say it's a master list of all possible General Contractors that I would use. They don't belong to any job until I choose one or more from that master list.

I have a BO called job. When I click on a job and drill into it, I have tabs. One of these tabs is called "Bids submitted to". Here is where I would have an Add button... and when I clicked Add, the master list of General Contractors (from the left) would appear and I could check 1 or more General Contractors from this list and they would now be the General Contractors for this job only.

I made the relationships but I have a disconnect I think in the "Add" button. I know I have to choose "Reference" but of what? The General Contractors query?
Regards and thanks,
Harry Carter
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Only show remaining that weren't picked previously

Post by tford »

Hi Harry,

Did you unzip the file in that thread and look at how it worked? That may help guide how you approach this.
Tom - V8.8 build 3137 - MySql / PostGres
numberz
Posts: 166
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Only show remaining that weren't picked previously

Post by numberz »

tford,
I didn't see it, sorry.
I just loaded it and will try to wrap my head around it.
I'm a bit primitive at this but I did see that you only had one peer relationship, yet you accomplished the goal.
Dang, I need to learn more...problem is, it always seems that what we need is never quite what is shown in help posts or documentation.
Regards and thanks,
Harry Carter
Post Reply