Options

CurrPage.EDITABLE together with CurrPage.UPDATE

FragenFragerFragenFrager Member Posts: 56
Hello,
we have made the following adjustments to the P41 for some customers; When an offer is moved from the Released status to the Open status, it should be editable. Basically, it works, BUT, you first have to leave the offer completely and then open it again so that the fields are no longer disabled.
I've tried putting a CurrPage.UPDATE in a number of places, but either the page keeps calling itself again, or nothing happens at all.
Can't the editability of a page be controlled via CurrPage.UPDATE? Otherwise, is there another way to grant editability without reloading the page?

With kind regards

Answers

  • Options
    ExploreExplore Member Posts: 14
    I have suggestion. May be you can try to create a duplicate of the current record, clear the original record, and then modify it. By doing so, the record will be refreshed, allowing the fields to become editable. This eliminates the need for users to leave and reopen the offer.

    NewRec := Rec.COPY;
    CLEAR(Rec);
    MODIFY;

    I hope this helps
  • Options
    FragenFragerFragenFrager Member Posts: 56
    Hello Explore,
    thanks for your answer. However, I have a question to that; Isn't it necessary to move the content from NewRec to Rec, again?
  • Options
    ExploreExplore Member Posts: 14
    Yes
  • Options
    ExploreExplore Member Posts: 14
    Or you can control the editability of fields on a page without reloading it by using the "Editable" property and the "CurrPage.UPDATE" function.
    1. Open the Page Designer for your P41 page.
    2. Locate the fields that need to be editable based on the offer status.
    3. Set the "Editable" property of these fields to a Boolean variable (e.g., "IsEditable").
    4. In the code behind the page, create a function (e.g., "UpdateFieldEditableStatus") that determines the value of "IsEditable" based on the offer status. This function should be called whenever the offer status changes.
    5. Within the function, update the value of "IsEditable" based on the offer status. For example, if the offer status is "Released," set "IsEditable" to "FALSE", and if the offer status is "Open," set "IsEditable" to "TRUE".
    6. After updating "IsEditable", call "CurrPage.UPDATE(FALSE)" to refresh the page and apply the changes to the field's editability.
    VAR
        IsEditable: Boolean;
    
    PROCEDURE UpdateFieldEditableStatus();
    BEGIN
        // Check the offer status and update IsEditable accordingly
        IF "Offer".Status = "Offer".Status::Released THEN
            IsEditable := FALSE;
        ELSE
            IsEditable := TRUE;
        
        CurrPage.UPDATE(FALSE);
    END;
    
  • Options
    FragenFragerFragenFrager Member Posts: 56
    Hello Explore,
    I'm very sorry to react to your post that late. I will give it a try as soon as possible. Thank you very much for your efforts.
Sign In or Register to comment.