Need help with creating wages per job

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: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Need help with creating wages per job

Post by numberz »

Hi and TIA
I have a Job BO.
The Job BO has a form called Daily wages
The Job BO has an Attribute:
ps_MasterWageDetail


I have a MasterWageDetail BO
The MasterWageDetail BO has Attributes as follows:
DailyWage
ps_MasterWageTypes
ps_WorkerDescription
sc_MasterWageTypes
sc_WorkerDescription

I also have a Query for Creating Master Wage Details

When I create a Job, I'd like to cause the entries from the Query to be duplicated in a grid in a form (already made) in my Job.
I'm not even sure if I need another BO called JobWageDetails?
Regards and thanks,
Harry Carter
kklosson
Posts: 1665
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Need help with creating wages per job

Post by kklosson »

To clear, let me reiterate your need:

When you create the Job BO, you want to populate certain attributes with attributes from the reference attribute ps_MasterWageDetail. It seems you may need to do this based on one or more attributes entered in the Job BO during creation. If I have this right, here's my approach.

In the Update rules for the Job BO, add the following rule:

IF Job IS NEW THEN
FIND MasterWageDetails WHERE ([your_criteria])
Job.Attribute1=MasterWageDetail.Attribute1
Job.Attribute2=MasterWageDetail.Attribute2
etc...

I imagine the user selects MasterWageType from the MasterWageDetails BO. This is easily done when defining the MasterWageType attribute on the Job BO form. You will also want a rule to ensure MasterWageType is defined such as:

IF (Job IS NEW OR Job.MasterWage WAS CHANGED) AND Job.MasterWageType IS UNDEFINED THEN
REPORT ERROR 'Master Wage Type must be defined.'
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
numberz
Posts: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Need help with creating wages per job

Post by numberz »

kklosson, thank you.

Here is some better info perhaps.
wages.jpg
wages.jpg (134.58 KiB) Viewed 4603 times
Regards and thanks,
Harry Carter
kklosson
Posts: 1665
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Need help with creating wages per job

Post by kklosson »

Based on what I see here, you just need an update rule such as:

IF Job.WageType WAS CHANGED OR Job.WorkerDescription WAS CHANGED THEN FIND WageDetail WHERE WageDetail.WageType=Job.WageType and AND WageDetail.WorkerDescription=Job.WorkerDescription
Job.DailyWage=WageDetail.DailyWage

On the Rule, you may want to check the Dynamic checkbox, but I've never made a rule dynamic that includes a FIND action, which I assume is triggered with every form action or keystroke. Might work fine but the WAS CHANGED action is probably only triggered during record save.

I don't see where you need to display the WageDetail list on the form since the droplists make those selections.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
numberz
Posts: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Need help with creating wages per job

Post by numberz »

kklosson,
The 'your criteria' is the part I haven't a clue about

IF Job IS NEW THEN
FIND MasterWageDetails WHERE ([your_criteria])
Job.Attribute1=MasterWageDetail.Attribute1
Job.Attribute2=MasterWageDetail.Attribute2
etc...

I guess I'm asking, where what?
Regards and thanks,
Harry Carter
kklosson
Posts: 1665
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Need help with creating wages per job

Post by kklosson »

I think that is resolved in my second response. You want to FIND the WageDetail object based on the two selections in the Job object. That's the criteria but my second response prevails based on the information as I understand it.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
numberz
Posts: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Need help with creating wages per job

Post by numberz »

Having a tough time...

In Job Update Rules, I have this:

IF Job IS NEW or Job WAS CHANGED
THEN FIND MasterWageDetail WHERE (MasterWageDetail=Job.ps_MasterWageDetail)
Job.WageType=MasterWageDetail.ps_MasterWageTypes
Job.WorkerDescription=MasterWageDetail.ps_WorkerDescription
Job.DailyWage=MasterWageDetail.DailyWage
Regards and thanks,
Harry Carter
kklosson
Posts: 1665
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Need help with creating wages per job

Post by kklosson »

No, I think your approach is off a bit. The MasterWageDetail objects are the various job descriptions and wages. In the Job object, the user selects the Union/Non-Union and Description attributes which you use to lookup the wage in the MasterWageDetail table and bring in the daily wage.

So, your rule needs to use the two attributes to find the correct position and fetch the wage.
FIND WageDetail WHERE WageDetail.WageType=Job.WageType and AND WageDetail.WorkerDescription=Job.WorkerDescription
Job.DailyWage=WageDetail.DailyWage

That FIND brings the WageDetail object into context and you can put its DailyWage into the Job object.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
numberz
Posts: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Need help with creating wages per job

Post by numberz »

No because:

In MasterWageDetails, I create all of the possible Wage Types, Workers and Wages.
All I need is to literally copy all of this information to each job, with only the Wage being editable.
Nothing is being chosen or selected here, it's just a place to list all of the Job Wage Detail info.
Just a copy but in grid form with no grouping, meaning straight across, each worker on a separate row.

It is in other places that the info from that is 'copied to job'... will be utilized.
Regards and thanks,
Harry Carter
kklosson
Posts: 1665
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

Re: Need help with creating wages per job

Post by kklosson »

Okay, so for each job, you are copying the entire master list, and I presume the user selects the applicable labor for the job?
For this, you should use the DUPLICATE action as shown here:
https://www.awareim.com/dokuwiki/doku.p ... plicate%2A

However, I'm not sure how you relate each item to the Job in context. You may need a business rule in the object created during duplication such as:

WageList.Job=Job
This would assign the Job.ID to each WageList object as it is duplicated.

If my understanding is correct, you might consider a process that uses PICK FROM (Query) enabling the user to pick the specific Positions from the master list and populate a list related to the job. The user could always revisit the query/process to add additional positions. This seems more intuitive to me and is easily implemented.
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Heavy on AwareIM Reports
nhofkes
Posts: 129
Joined: Mon Sep 07, 2020 6:03 am
Location: Netherlands

Re: Need help with creating wages per job

Post by nhofkes »

numberz wrote: Tue Oct 29, 2024 3:06 am No because:

In MasterWageDetails, I create all of the possible Wage Types, Workers and Wages.
All I need is to literally copy all of this information to each job, with only the Wage being editable.
Nothing is being chosen or selected here, it's just a place to list all of the Job Wage Detail info.
Just a copy but in grid form with no grouping, meaning straight across, each worker on a separate row.

It is in other places that the info from that is 'copied to job'... will be utilized.
Duplication of data is generally not a good idea. A significant part of good database design is to avoid duplication as much as possible (and the process to do so is usually referred to as 'normalization'). If you would want to display all of the MasterWageDetails (i.e. all existing combinations of Wage Types, Worker Types and Wages), you could just display a query. And if you need to select a specific item from that list, you can use PICK FROM as already mentioned. You don't need to include (copy) all data from one BO into another BO.
Niels
(V9.0 build 3272 - MariaDB - Windows)
numberz
Posts: 207
Joined: Sat Aug 05, 2017 12:13 am
Location: New Hampshire - USA

Re: Need help with creating wages per job

Post by numberz »

Thank you.
Regards and thanks,
Harry Carter
Post Reply