How does one access the information returned on a subform table or tablebox as a result of filtering/sorting? For example, if a form contains a subform using the vendor ledger entry form, how would you count the number of resulting items or get the value of any of the fields displayed on the subform as the result of a filtering action? Thanks in advance.
The easiest way to do this is to set up a flowfield on the parent table which the main form displays. I will warn you, that the values don’t get updated till you click on the main form. There are several flowfields (e.g., “Amount”) on the Sales Header record. If you add one of these to the Sales Order or Sales Invoice form, you can see how this works. --Tim Horrigan Tim.Horrigan@emsolution.com ------- Tim Horrigan
Thanks for the reply, Tim. Basically though, what I have is the Vendor Card modified to include the Vendor Ledger Entries form as a subform. The user may add a filter to show only Invoices (as an example) for that particular vendor on the ledger entry subform (the filter/sort could also be a result of a SourceExp entry of the subform itself). I need to be able to loop through the resulting invoices displayed on the Vendor Card subform and grab an item from each (i.e. External Document No.) in order to construct a search string for use in an external application. A good old FOR…NEXT is in order here, but apparently that is only good for working directly on the underlying tables.
First you have to give a name to the SubForm. (Property Name=VLEForm). If you want to access the currently selected VLE from the Vendor Form use: CurrForm.VELForm.FORM.GETRECORD (MyVLEEntry); So far it will work for sure. I didn’t test it but it might be that MyVLEEntry will not only contain the data of the current VLE record but also the filters and therefore will allow you to do a count. Marcus Marcus Fabian phone: +41 79 4397872 firstname.lastname@example.org
Marcus, Once again you have come to my aid! “CurrForm.VELForm.FORM.GETRECORD (MyVLEEntry)” certainly returns the selected record on the subform, but GETFILTERS returns nothing. This is maddening! Since the subform does not display the full dataset returned by a filtering action, looping through the subform does no good (I can’t seem to find a way to get the first ‘record’ displayed on the subform and NEXT loop through it, anyway). I guess I need some method to return the actual filters applied via the Vendor Card subform properties (as well as any set at run-time from the toolbar), then use the returned filters to reset the same filters in code with SETFILTERS, then do the FIND(’-’) and then do the old REPEAT UNTIL NEXT on the resulting dataset. There’s got to be an easier way that I’m not finding. Hoping you can bail me out,
If I understand your question correctly then I think this should work. On the subform define the following function: ReturnRecord(Var VendorLedger : Record “Vendor Ledger Entry”) VendorLedger.copy(Rec); On the parent form create a recod variable for the vendor ledger entry table and call the above function on the subform with this variable as a parameter: CurrForm.SubformName.FORM.ReturnRecord(VendorLedger); The VendorLedger varible should contain all the information you need about filters and keys on the subform.