AnsweredAssumed Answered

Cleaning up a calculation

Question asked by SteveMartino on Apr 20, 2016
Latest reply on Apr 21, 2016 by Extensitech

Hi Forum.  In my effort to try to do things the a better way, I was wondering if there is a better way to do this calculation.

What I am trying to accomplish is to not allow a user to leave this screen without entering data in 4 specific fields, while creating a new record.

I don't want to use field level validation (not is empty checkbox), because these fields are used on other layouts where the fields can be empty).

Another option I considered is using all globals for creating a new record, then validating, then committing.  I think this may be the better approach.

But here's what I have.  Here's the script in a screen shot, and the calculation:

Let( [
       @state=Case(IsEmpty(DESIGNCHART::State);1);

       @city=Case(IsEmpty(DESIGNCHART::Station);1);

       @DesignTemp=Case(IsEmpty(DESIGNCHART::Design_Temp_Winter);1);

       @Dday=Case(IsEmpty(DESIGNCHART::Heating_DDAYS);1);

       @Count=Count(@state;@city;@DesignTemp;@Dday);

       @txt=Case(@Count>1; "The following fields require data-";
          @Count>0; "The following field requires data-")
      
     ];

@txt & Substitute(
         List (
               Case(IsEmpty(DESIGNCHART::State);"State") ;
               Case(IsEmpty(DESIGNCHART::Station);"City") ;
               Case(IsEmpty(DESIGNCHART::Design_Temp_Winter);"Design Temperature-Winter");
               Case(IsEmpty(DESIGNCHART::Heating_DDAYS); "Heating Degree Days")
                ); //End List
                       
          "¶";", ")  //End Substitute

)//End Let

 

Any thoughts, suggestion, help are always greatly appreciated.

Thanks

Steve

Attachments

Outcomes