I have two questions that I haven't been able to find answers to.
1. Given a FieldRef that has a RELATION <> 0, is it possible to either find or dynamically run the default form for the table defined by the relation? For example, if I got a fieldref to the "Item No." field in Item Ledger Entry, is there some way that I can dynamically run the Item Card, as it is the default form for the Item table?
2. Given a subform, how can I allow users to select specific records within that subform and run some action that is hosted in the parent form (like a codeunit or report)? How do I determine which records they selected?
0
Comments
See also http://www.mibuso.com/forum/viewtopic.php?f=23&t=35084
2. One way (and possibly the only one) could be to implement the OnTimer trigger in the main form which can periodically check if there is some request initiated by the subform.
RIS Plus, LLC
MVP - Business Apps
That's awesome. I really appreciate the help there.
I'll look at the SETSELECTIONFILTER() method. I tried running through the help, but sometimes, when you don't know where to start, it's like a needle in the proverbial haystack.
RIS Plus, LLC
MVP - Business Apps
Unfortunately the way with RecordRef is not working... I already requested this but there is no possibility to pass RecordRef to form through standard way, else this will be very good solution for many cases...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I wish NAV provided more support for on-the-fly object typing. The FieldRef and RecordRef are really useful, up to this point.
I hit the wall on this yesterday, when I remembered that to use the form specified by the LookupFormID as a lookup, I would have to pass in a record variable to capture the lookup result. That doesn't work if I don't know ahead of time what type of record variable it might be.
I was hoping to do something like this:
but it doesn't work...
My company needs to be able to produce barcodes out of NAV, but the problem is that we do a lot of work for external companies, and each customer could potentially have different barcode formats.
We're looking at a product called Bartender, which functions as a barcode printing/communication server, and are looking to integrate with it through either TCP/IP socket connections or MSMQ and a middle-ware component in .Net.
I've written a series of tables and a codeunit to function as a barcode printing engine that will take an input record, run it through a series of value/filter-based rules, evaluate which type of "usage" is involved (Production order for customer X, shipment for customer Y, etc...), and run a codeunit that is defined (by ID) as part of that "usage". The system has a table that contains all of the fields that we currently use in barcoding (item number, vendor, lot. serial, etc...), and the Usage codeunits are responsible for taking the source data and mapping it into this table. When the user wants to print the barcode, it takes those transformed records and matches them up against another table, which defines which of those fields will map into which of the bartender barcode fields, creates an XML document, and streams the XML across the port to bartender to print.
The reason I'm asking these questions is that these rules allow us to select a field in the table that is defined for that usage and set either a static value that will be used to evaluate, or a filter value (If that rule evaluates to true, then it moves on to the next rule, if not, it moves to the next usage/ruleset). I'm using FieldRefs and RecordRefs pretty heavily to perform some validation on the data when the rules are set up (can't enter a character as the check value for a field that is defined as decimal, etc...), and even to present option values on the fly (I had to use STRMENU() to show the defined option values that are available).
I was going to try to dynamically show parent records for fields that were relational, but maybe I'll have to forgo that.
Thanks.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
I wonder if you'd be willing to answer one more for me.
I've tried this in the subform:
and then, in the header form, I call it like so:
I'm using generic names here, but you get the point.
When this function is called when NO selections have been made it still returns 1 record, which I don't understand. If I haven't selected a record, then why am I getting one out of the filter? Do you see anything glaringly wrong here, or am I misunderstanding/misusing this function?
Nevermind. The help just misled me here a bit.
I placed a call to "Record.MARKEDONLY(TRUE);" after the Record.FIND('-'); and it is working as expected.
Thanks again!
MARKEDONLY and SETSELECTIONFILTER are two commands that have nothing in common.
With MARKEDONLY(TRUE) you will get all records that have been previously marked. To mark a record, you can press Ctrl+F1, e.g., or you can do it from C/AL with Record.MARK(TRUE). Marked records appear with a characteristic dot to the left of the record in a tabular form:
With SETSELECTIONFILTER you will get all records that have been previously selected. You can select a record / several records basically the same way, you highlight text in a text editor, e.g. (holding down the mouse button and draw the mouse over the records, additionally holding down the Shift or Ctrl-Button to select a block of records, or several records, respectively. As a result, the selected records always appear with a blue background (except one case: the current record is always selected, even if it is not blue):
RIS Plus, LLC
MVP - Business Apps
gerd -
Not sure I follow you. This is from the NAV C/SIDE online help...
The way I'm reading this, it is saying that SETSELECTIONFILTER results in MARKED records based on what was selected on-screen.
Thanks for the sample. This is almost the exact setup that I originally had, and I could see the count of selected records, but the actual record variable was empty when it came back to the caller.
When I called MARKEDONLY() and FIND('-') after SETSELECTIONFILTER, I was able to see the records, but neither call by itself gave me the desired results.
So the FIND is quite necessary (normally it is done in the main form). But - as I try to point out - the MARKEDONLY(TRUE) should be completely unnecessary (please see the example below).
May be it's version dependent. I tried it within NAV 5.0 (SP1) - What version are you on?