0

Issue with a script that does not display the expected value when two fields are equal

Pgr.('Total Earned Value' := if cnt((select 'Progress-Cost Report')['Total Earned Value' = xFld4]) > 0 then
                null
            else
                xFld4
            end);

 

The problem with the part script is that when the "Total Earned Value" values in both tables are the same, null is assigned to the "Total Earned Value" variable, which means that the original value is lost.

I try this but don't work.

Pgr.('Total Earned Value' := if cnt((select 'Progress-Cost Report')['Total Earned Value' = xFld4]) > 0 then (select 'Progress-Cost Report')['Total Earned Value'] else xFld4 end);

3 replies

null
    • Fred
    • 4 mths ago
    • Reported - view

    Is this the same code as below?

    let Pgr := (create 'Progress-Disciplines');
            Pgr.(Discipline := xFld0);
            Pgr.('Date CutOff' := xFld1);
            Pgr.('Week CutOff' := xFld2);
            Pgr.('Total Plan Value' := xFld3);
            Pgr.('Total Earned Value' := if cnt((select 'Progress-Disciplines')['Total Earned Value' = xFld4]) > 0 then
                    null
                else
                    xFld4
                end);
    

    Since it is part of a create() command, 'Total Earned Value' will be empty by default, so don't you just use xFld4 variable by itself?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 4 mths ago
      • Reported - view

       

      Hi Fred yes the same code.

      Sorry don,t understood your comment.

    • John_Halls
    • 4 mths ago
    • Reported - view

    Hi Rafael

    It’s the same as the code I reduced in size in your last post. Take a look at it.  I took out the if.. else part where you set a field to null.

Content aside

  • 4 mths agoLast active
  • 3Replies
  • 43Views
  • 3 Following