Run form with RecRef

new_to_calnew_to_cal Member Posts: 21
Hi folks!

I currently have a slight problem with a RecRef: I would like to show it in a form.
During runtime I know which form I would have to run, but how do I get the filters of the RecRef to filter the Recs shown on the form.
For instance:
RecRef.Open(27);
FieldRef := RecRef.FIELD(1);
FieldRef.SETRANGE(RandomFilter);
FORM.RUN(31);
I would like to filter the Form with the same Filter I use on the RecRef WITHOUT having to define a variable for almost every Table in the System...

Comments

  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I guess that's not possible in this way.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • new_to_calnew_to_cal Member Posts: 21
    In which way would it be possible?

    :P
  • deV.chdeV.ch Member Posts: 543
    If you want to Transfer Filters of a recordRef to a record you need to use setview / getview. So you need to have an instance of that record...

    What do you try to do in the first place? why do you need to open lots of different forms with a recref instance?
  • pdjpdj Member Posts: 643
    Nothing is impossible for Justas from Vilnius... 8)
    viewtopic.php?t=9247

    However; I would never dare use it in a production environment...
    Regards
    Peter
  • deV.chdeV.ch Member Posts: 543
    this is crazy...

    If you just need to show records and not edit something i would recomend to use a temporary table add like 100 textfields , fill this table based on the recordref with records and show this in the form... The captions can you get from recref too and send it to form and apply that on runtime.
  • wakestarwakestar Member Posts: 207
    I would try to solve it with a single instance codeunit and two functions...

    SetRecRefFilter
    GetRecRefFilter

    Before calling the form you use SetRecFilter to save the actual filter from the recref
    In OnOpenForm you use GetRecFilter to read the filter from the single instance codeunit
  • deV.chdeV.ch Member Posts: 543
    Then you need to put code on every form you want to use with this... Then it's even better to use an instance for every record type und put that in one function then its all in one place.
  • wakestarwakestar Member Posts: 207
    oops, yeah, I thought he was talking about one form showing data from all kind of possible records
  • einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    new_to_cal wrote:
    In which way would it be possible?
    There are a couple of work arounds, some are already mentioned above. It depends on what you want to achieve.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • new_to_calnew_to_cal Member Posts: 21
    pdj wrote:
    Nothing is impossible for Justas from Vilnius... 8)
    viewtopic.php?t=9247

    However; I would never dare use it in a production environment...

    I like the idea. Why wouldn't you use it in a production environment?
    Nevertheless: Thanks for the input everyone!
  • BeliasBelias Member Posts: 2,998
    new_to_cal wrote:
    I like the idea. Why wouldn't you use it in a production environment?
    Nevertheless: Thanks for the input everyone!
    I've never used this method, either (but :thumbsup: for justas to figure it out), but i think this is not really "safe" in a multi user environment (i've never tested it, but i don't want to be the first one to do it :) ).
    P.S.: i've just seen that he said "Even with several concurent users".
    Anyway, i'd go for garak's solution, if possible
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • leugimleugim Member Posts: 93
    hi there

    nothing new to say about running form(0) with a recordref variable. forms are designed to show data from a specific record, so it's a matter of design.

    but, thinking about the standar, i remembered using the Setup Checklist function, under Administration, Application Setup, General, Setup Checklist menu. i thought this could fit most of my requirements...

    my case: we are designing an interface to retrieve data from AS400 to Dynamics via ODBC. we design a simple, intermediate table in which inserting several equivalencies between Dynamics and AS400, with three columns: Table Id, Code, Eq. Code, for saving table id from Dynamics, code from this table in Dynamics and code from AS400. when in Code column, it would be great if we could open the form(0) of the table shown in our Table Id column.

    this is where Setup Checklist must play its role. we use the standard functionallity to call codeunit 406, using a record variable pointing to table 344, so we can open the corresponding form and view data from that table. it's not possible to retrieve codes (...yet :lol: ...) but we could copy and paste.

    not the best solution but it works, with two lines of code.

    hope it could help.
    _______________
    so far, so good
Sign In or Register to comment.