0

Problem in my DB WorkOrder

Hi Fred, I have a problem that I don't know how to solve.

I have a simple Engineering Workorders database. I can have several WorkOrders. Each workorder has several activities with their hours and budget.

Each order has its Data|Date, Milestones, CuOff, KPIs, Progress Report, and objectives and scope, all in tab.

The problem is the WS-Progress Report table, which I generate with the button on the DATA|DATE tab and with CutOff. day, which I generate with the CUTOFF tab.

How can I assign these two tables to the each workorder?

12 replies

null
    • Fred
    • 3 days ago
    • Reported - view

    I think you do know how to solve the issue, but sometimes the solution is slipped our minds.

    Remember that when you use the create() command, all it does is create a new blank record. So if you want to link a progress report or cutoff record to ENG WORKORDER then you need to specify the link.

    After reviewing the code in the two buttons, I don't see you linking to the ENG WORKORDER table anywhere. I noticed that you changed the reference field links in each table so make sure you use the reference field name and not the table name.

    Give it a try and let us know how it goes.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 3 days ago
      • Reported - view

       

      Hi again.

      I create a N:1 from 'WS-Progress Report' to 'ENG WORKORDERS' and

      N:1 from 'CutOff days' to 'ENG WORKORDERS' But don't remember how cgange the code.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 3 days ago
      • Reported - view

        

      let Pgr := (create 'WS-Progress Report');
                  Pgr.('WO#1' := loopWO);

      I thing is the way ? 

    • Fred
    • 3 days ago
    • Reported - view

    Looking at the buttons again, you fixed the Calculate dates button. It links the cutoff date records to the ENG WORKORDERS record correctly. Now just repeat it in the Create Progress Report button. The field you need to focus on is the 'ENG WORKORDERS' field.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 3 days ago
      • Reported - view

       

      Hi Fred, now the botton in Tab CuttOff, generates the dates in CutOff days for the corresponding workorder 2, but now need in Data|Date with the botton Create Progress Report generate the WS-Progress Report for the WorkOrder2 with the dates of workoder 2

      Each Workorder will have different dates. Unfortunately I can't do it

      • Fred
      • 2 days ago
      • Reported - view

       You have cutoff dates linked to ENG WORKORDERS so use that reference link in your for loop.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 days ago
      • Reported - view

       

      that I'm supposed to enter on line 20 ? 

      let vDd := 'Add Data|Date';
      let vDD := 'Add Data|Date';
      let check := dialog(" Warning ", " ¿Confirm the Update Progress Project? ", ["Yes", "No"]);
      if check = "Yes" then
          let xPry := first(select 'ENG WORKORDERS');
          for loop1 in select 'CutOff days' do
              'Add Data|Date' := loop1.DateCO;
              let xFld0 := xPry.'WO#';
              let xFld1 := xPry.'Progress Plan';
              let xFld2 := xPry.'Progress Real';
              let xFld3 := xPry.Data_Date;
              let xFld4 := xPry.Week;
              let xFld5 := xPry.'Planned Value PV';
              let xFld6 := xPry.'Earned Value EV';
              let xFld7 := xPry.'Actual_Cost Week AC';
              let xFld8 := xPry.'Cumulative Cost';
              let xFld9 := xPry.SPI;
              let xFld10 := xPry.CPI;
              let Pgr := (create 'WS-Progress Report');
              Pgr.('WO#1' := xFld0);
              Pgr.('Progress Plan' := xFld1);
              Pgr.('Progress Real' := if cnt((select 'WS-Progress Report')['Progress Real' = xFld2]) > 0 then
                      null
                  else
                      xFld2
                  end);
      
      • Fred
      • 2 days ago
      • Reported - view

       Always try to minimize your use of selects. So your for loop on line 6 can use the reference field 'CutOff days' instead of the select.

      I'm not sure why you use the select on line 5 as well. Don't you want to reference the ENG WORKORDERS record you are on?

      In the WS-Progress Report table, you have two reference fields to ENG WORKORDERS. You only need one. It is this field that you need to link to the ENG WORKORDERS record that you are on. Just reference the same link code you did in the 'Calculete Date' button.

    • Fred
    • 2 days ago
    • Reported - view

    Have you considered making Progress Reports a child of Cutoff Days? Since you want to make a report for each record in Cutoff days. So you only need to link the progress report record to a Cutoff days record and since Cutoff days are linked to Workorders you have that link as well.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 2 days ago
      • Reported - view

       

      I will try to implement it today, let's see.

      Thanks

      • Fred
      • yesterday
      • Reported - view

       Also start your scripts just doing the basics, make a new record and then link to proper records. Once all that works then you can add in the field updates.

      • Rafael Sanchis
      • Rafael_Sanchis
      • yesterday
      • Reported - view

       I have a solution although I have problems with the weeks in the 2nd workorder.

      I'm not sure if this is practical. These are small projects with no more than 12 activities, but there could be about 20 workorders, each with different dates, and of course, the Data|Dates are diferent from each workorderd . I'll keep trying, but for now, I'll handle them individually.

Content aside

  • yesterdayLast active
  • 12Replies
  • 60Views
  • 2 Following