Form.run and RefRef

garakgarak Member Posts: 3,263
Hy,

i'm right, that it is not possible to open a form.run(21,RecRef) based on RecRef :?:

Has somebody an idea why not:?:

The only solution that i have:
//FieldFilter is a temp table which includes the Filter for every field
IF NOT FormRunModal(TableNo,FieldFilter) THEN BEGIN
...
end;

FormRunModal(TableNo : Integer;FieldFilter : Record)

CASE TableNo OF
  DATABASE::Customer:
    BEGIN
      Cust.RESET;
      //select here the fields an the used filter
      ...

      FORM.RUNMODAL(0,Cust);
      
    END;
...
end;


Regards
Do you make it right, it works too!

Comments

  • kinekine Member Posts: 12,562
    Yes, this is the solution, no another way...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    :idea: i have found an Solution. The only negative is: you must know the form id that you will run. But you dosn't need for every Record a Variable. You must only know which formno you will run for which RecRef table instance.
    Do you make it right, it works too!
  • krikikriki Member, Moderator Posts: 9,118
    garak wrote:
    :idea: i have found an Solution. The only negative is: you must know the form id that you will run. But you dosn't need for every Record a Variable. You must only know which formno you will run for which RecRef table instance.
    Care to share your solution to the Navision community? You might also write a "Navision Tips & Tricks"-post with your solution.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • BalelloBalello Member Posts: 61
    You need to base a form on a recordRef, isn't it? It depends on what you want. There isn't a single solution. For example I recently released a form based on a temporary table of the field table. It accept the tableID as input and then it works like a Report RequestForm only that it works for every table. When you close the form you have your RecordRef filtered. If you want something different such as a form based on EVERY table, I guess that it could be done as follows:
    1) You must create a table with the number of fields you want to show.
    Its fields are text fields.
    The point is the fields you want to show on the form. Suppose the first 5 of the table or something like that. Or you can see some fields that you can set via code using a temporary table of Field table.
    2) You create a form based on that table.
    3) On OnInit trigger you can write code to copy all records you want to see on a temporary table of the actual Form "Rec", using obviously the Format(fieldRef.value()); Be careful that you must write a loop on the field table to set the value for every field.
    4) You can write code on the OnFindRecord and OnNextRecord to substitute Rec (that's a real empty table) with the temporary table. You can find how on the Where-Used form.

    Then you set the caption using the Field table and it's done.

    Clearly this form must be run after some setting function and so using a variable, not "form.run(formID)".

    I think it will work.

    If you need to run an existing form you obviously can't do that because it's based on an existing table and the only way to manage is to use "CASE" as you said.
    I don't envy anybody who caught up his aim. I travel gladly.
  • garakgarak Member Posts: 3,263
    I will post the Solution ( for RecRef an Form.run(ID,Record) under tips & tricks

    Regards
    Do you make it right, it works too!
  • jjanauskasjjanauskas Member Posts: 49
    Hi there,

    I posted another solution for this problem to http://www.mibuso.com/forum/viewtopic.php?p=41023

    Have fun!
Sign In or Register to comment.