How to set Boolean values to True

gadzilla1gadzilla1 Member Posts: 316
Hello all,

I've created three Boolean fields in the Customer table. These fields are represented by checkboxes on the Customer Card.

I've set the InitValue to Yes in each field which checks the checkbox for each new Customer I enter.

For each existing (old) Customer I'd like these boxes to be checked as well. Our customer service people will then uncheck as needed depending on the customer specs.

How do I get all the existing Customers 'checked' at once for these Boolean fields?

Thx - gad1

Answers

  • DatapacDatapac Member Posts: 97
    Hi,
    I'd suggest to create a processing only report on the Customer table, in the OnAfterGetRecord trigger of the Customer Data Item

    Boolean1 := 1;
    Boolean2 := 1;
    Boolean3 := 1;
    MODIFY;

    Hope this helps :)
  • krikikriki Member, Moderator Posts: 9,110
    Create a form on the table and put some fields on it.
    In the OnOpenForm-trigger, put:
    MODIFYALL("Boolean 1",TRUE);
    MODIFYALL("Boolean 2",TRUE);
    MODIFYALL("Boolean 3",TRUE);
    

    BE VERY CAREFULL IF YOU USE THIS WAY FOR OTHER THINGS. YOU CAN EASILY DESTROY YOUR DATA!
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • gadzilla1gadzilla1 Member Posts: 316
    Thanks all!

    kriki: I only plan on doing this once, and just for those fields. Are you saying that even if I do this 1x, as specified above, there is still risk?

    Or rather, that rampant use of this will increase risk of data loss.

    Because, if there is risk REGARDLESS, well they'll just have to use the Customer card to make changes. :D
  • SavatageSavatage Member Posts: 7,142
    The update report is really really easy to do as stated above.
    Just substitute MyBooleans with your field names.
    You still will have access to a reqest form where you can filter if need be.

    like Blocked:No for example

    OBJECT Report 50081 OneTimeCustBoolYes
    {
      OBJECT-PROPERTIES
      {
        Date=07/25/07;
        Time=[ 1:26:16 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table18;
            OnAfterGetRecord=BEGIN
                               Customer.MyBoolean1 := TRUE;
                               Customer.MyBoolean2 := TRUE;
                               Customer.MyBoolean3 := TRUE;
    
                               Customer.MODIFY;
                             END;
          }
          SECTIONS
          {
            { PROPERTIES
              {
                SectionType=Body;
                SectionWidth=12000;
                SectionHeight=846;
              }
              CONTROLS
              {
              }
               }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        BEGIN
        END.
      }
    }
    
  • gadzilla1gadzilla1 Member Posts: 316
    Harry,

    That's pretty cool! I ran this in test and it works great. I will run this 1x in live from object designer and then delete it.

    I'm always tentative when it comes to data changes to live stuff. :D

    Thanks everyone - Gad1
  • krikikriki Member, Moderator Posts: 9,110
    gadzilla1 wrote:
    Thanks all!

    kriki: I only plan on doing this once, and just for those fields. Are you saying that even if I do this 1x, as specified above, there is still risk?

    Or rather, that rampant use of this will increase risk of data loss.

    Because, if there is risk REGARDLESS, well they'll just have to use the Customer card to make changes. :D
    No problem in this case, but with "rampant use", you risk dataloss. Meaning, you just want to modify certain records and you forget to put the filter first.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • gadzilla1gadzilla1 Member Posts: 316
    Harry,

    I was going through old threads and realized you had replied..thanks for that tip in your last post.

    I read through the entire application designer's guide this past month. Things are really coming together. I really appreciate your help and the help of others on this site.

    Take care - gad1
Sign In or Register to comment.