Is there a way to select Yes when a mesage pop up

fmhiguefmhigue Member Posts: 290
I am writing a report to update Price Group Code on the Special-Frozen Price table.

But Price Group Code is a key.
SO I want to run my report and seleck Yes on the fly.

Any ideas?

Comments

  • David_SingletonDavid_Singleton Member Posts: 5,479
    fmhigue wrote:
    I am writing a report to update Price Group Code on the Special-Frozen Price table.

    But Price Group Code is a key.
    SO I want to run my report and seleck Yes on the fly.

    Any ideas?

    You need to use the RENAME command directly on the record instead of validating then modifying the record.

    Is this a one of fix? If so then fine. But if this is a regular routine, then you need to redefine the data model.
    David Singleton
  • garakgarak Member Posts: 3,263
    But note, a rename can run very long if it is a big table. Sometimes it's faster to delete and insert then a new rec.

    For the price table, there are no table relations to these field so you can also:

    Copy the rec, delete the rec, change the needed field in copy, insert the rec from copy.

    But if you are not sure if this work for u, use, like David say, the Rename command.

    Regards
    Do you make it right, it works too!
  • fmhiguefmhigue Member Posts: 290
    David - Garak:
    This is the code I got on a report to change the values on the field


    SETFILTER("Customer Type",'Chain');
    SETRANGE("Price Group Code",'140');

    IF "Frozen-Special Price".FIND('-') THEN
    REPEAT
    "Price Group Code":= 'AALFS';
    "Frozen-Special Price".MODIFY;
    UNTIL "Frozen-Special Price".NEXT = 0;
  • David_SingletonDavid_Singleton Member Posts: 5,479
    fmhigue wrote:
    David - Garak:
    This is the code I got on a report to change the values on the field


    SETFILTER("Customer Type",'Chain');
    SETRANGE("Price Group Code",'140');

    IF "Frozen-Special Price".FIND('-') THEN
    REPEAT
    "Price Group Code":= 'AALFS';
    "Frozen-Special Price".MODIFY;
    UNTIL "Frozen-Special Price".NEXT = 0;

    Is this code in the on after get record trigger in the report? The context does not make sense. What is the WITH here?
    David Singleton
  • garakgarak Member Posts: 3,263
    SETFILTER("Customer Type",'Chain');
    SETRANGE("Price Group Code",'140');

    IF "Frozen-Special Price".FIND('-') THEN
    REPEAT
    "Price Group Code":= 'AALFS';
    "Frozen-Special Price".MODIFY;
    UNTIL "Frozen-Special Price".NEXT = 0;

    First: I'am wondering, why you use the Rec Variable "Frozen-Special Price" for the loop, but you change the the CurrRec. Or is there an With "Frozen-Special Price" Do begin statement infront of?

    From where is this code called :?: OnPreDataItem / OnPostDataItem / OnAfterGetRecord (as David sayed)

    normally u make a rename like this:
    SpecialFroznPrices.reset;
    SpecialFroznPrices.SETFILTER("Customer Type",'Chain');
    SpecialFroznPrices.SETRANGE("Price Group Code",'140');
    IF SpecialFroznPrices.FINDset(true,true) THEN begin //onSQL, Native find('-') with an sep. Rec Variable to rename
      REPEAT
        SpecialFroznPrices.rename(PKField1,'AALFS',[PKField N]; //if Price Group is the second Primary key field
        "Frozen-Special Price".MODIFY;
      UNTIL SpecialFroznPrices.NEXT = 0;
    end;
    
    an other way is following (if there are no tabl. relations)
    
    TempSpecialFroznPrices.reset; //temp. Variable
    TempSpecialFroznPrices.deleteall;
    
    SpecialFroznPrices.reset;
    SpecialFroznPrices.SETFILTER("Customer Type",'Chain');
    SpecialFroznPrices.SETRANGE("Price Group Code",'140');
    IF SpecialFroznPrices.FINDset(true) THEN begin
      REPEAT
        TempSpecialFroznPrices := SpecialFroznPrices;
        TempSpecialFroznPrices.insert;
      UNTIL SpecialFroznPrices.NEXT = 0;
    end;
    
    SpecialFroznPrices.deleteall;
    TempSpecialFroznPrices.reset;
    if TempSpecialFroznPrices.find('-') then begin
      repeat
        SpecialFroznPrices.init;
        SpecialFroznPrices := TempSpecialFroznPrices;
        SpecialFroznPrices."Price Group Code":= 'AALFS';
        SpecialFroznPrices.insert;
      until TempSpecialFroznPrices.next = 0;
    end;
    

    Regards
    Do you make it right, it works too!
  • David_SingletonDavid_Singleton Member Posts: 5,479
    fmhigue wrote:
    SETFILTER("Customer Type",'Chain');

    Oh and this is just so wrong in more ways than I can even imagine.
    David Singleton
Sign In or Register to comment.