Problem when updating a Form !

rmouzarmouza Member Posts: 52
Hello EveryBody,

I've developped a form in wich i displayed information from Sales Line table (Ver 4.02) automatically with a Process only report.
The problem is that the "CurrenForm.Update" doesn't function at the first time when activating the "OnActivation" Trigger. But it does at the second time!!!
Can someone help me please ! [-o<

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    I am not completely clear on what you mean :?

    Do you populate the data via a report? What is the structure of your code?
  • rmouzarmouza Member Posts: 52
    Yes i do this with a Report (Processing only). i need some information from Table "Sales Line" then i display data in a formular (of course the report and the formular are based on a table).
    The "Editable" property of all my formular's columns are set to "NO"!
    The problem is that : On the FIRST (Only the first) "OnActivate" of the formular, the "CurrForm.UPDATE" doesn't work (: the data are not displayed on the formular!!)!! But when i click on any other window in Navision, then i click on my formular, the lines (that the report extracted from the sales line table) appears.
    At the other extraction of line from Sales Line, there's no problems !!! (the lines appears directly)!

    Best regards.
  • kinekine Member Posts: 12,562
    Still, I am confused...


    Can you describe more, what is your goal and what you are doing? Something like:

    1) From one button I run report
    2) This report fill temp table with some entries
    3) The report run form which shows these temp records...
    (this is just example)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    thanks Kine!
    So:

    1--> i run a Form (wich will contain the information)
    2--> from one Botton i run a report (process only)
    3--> the report fill my From with informations from Sales line
    4--> The problem now is that the information aren't displayed

    NB: i know that when i activate an other window then i re activate my Form, the informations are displayed !
  • kinekine Member Posts: 12,562
    If you run the report through C/AL code on your button (in OnPush) than you need to add the CurrForm.Update into this trigger. If you are running the report through button properties, it will be better in this case to use C/AL code to run it.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    i tryed to put the "CurrForm.Update " in the "OnPush" trigger after running the report but it doesn't work!
  • kinekine Member Posts: 12,562
    You need to run the report from there too.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    This the Code i wrote :

    <Control1000000050> - OnPush()
    REPORT.RUN(50024);
    CurrForm.UPDATE;

    I also puted "CurrForm.UPDATE;" in the "OnActivate" trigger of the Form
  • ClausHamannClausHamann Member Posts: 80
    Try RUNMODAL to force Navision to wait for the report to finish before the update.
    REPORT.RUNMODAL(50024); 
    

    Regards

    Claus
  • rmouzarmouza Member Posts: 52
    Thanks Claus and all others,

    With "Report.RunModal" it works now!
    But there still a problem of updating the display of a sum in a textbox.
    I do the same thing to activate the new display of the new value!

    Should i put the crrForm.UPDATE somewhere too?
  • kinekine Member Posts: 12,562
    1) Where and how are you calculating the SUM?
    2) Where the edit box is placed?
    please, more info...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    1--> The SUM is calculated in the last line of a column.
    2--> Every time i add informations to my Form the sum is updated!
    3--> The text Box where i display the sum is in a Frame! aatached to the same Form.

    4--> The problem is that when i add iformation (the Sum is caulated automatically in the column) the TextBox containing the sum is not updated ==> doesn't contain the right (last) sum!
  • kinekine Member Posts: 12,562
    Still, the process of calculating the sum is not clear for me. In which trigger you are calculating it? Can you post some C/AL code example?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    Form - OnActivateForm()

    CurrForm.UPDATE;

    //---> Extract the Last Sum and affect it !

    IF Rec.FINDLAST = TRUE THEN
    BEGIN
    gDec_CumulDsResume := Rec."Cumul Besoins";
    END;

    This is the OnActivate trigger of my Form. And i display the sum in a text box in a frame.
    --> When i add lines in the FORM the SUM change there! But doesn't change in the text box !
  • kinekine Member Posts: 12,562
    Better is to calc the value in OnAfterGetCurrRecord. Try to not use the OnActivate trigger, it is not good place for updating something.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rmouzarmouza Member Posts: 52
    (I'm calc the SUM with a speciifc function. I put it in the trigger "OnActivate" of an other column needed for the SUM ) IN the Table in wich is based my FORM .
Sign In or Register to comment.