Hey everybody, I have a table for example with the following records in : 1 QT01 BAF 2000 2 QT01 BAF 4000 3 QT01 CAF 3000 4 QT01 BAF 1000 Now when i choose on a form as filter QT01 Te result in the subform has to be 1 QT01 BAF 7000 2 QT01 CAF 3000 How can i do that ? They told me with a temporary table or something. Thx a lot Now
Hi You can make a temporary table, by making a record variable as usual, and the setting the properties of the variable to make it temporary. There are two different properties, so you won’t have trouble finding it. The you can make a loop, where you filter for each of the BAF,CAF etc. and subsequently adds all the values to the right. The adding might be done by a flowfield. Then you can insert each of your new records in your temporary table, and use that for your subform. E.g. Variable record Table : tTable Table.SetRange( Letters, BAF ); Table.CalcSums( Value ); tTable.COPY( Table ); I don’t know if the code is entierly correct, but hopefully it should give you the idea. Henrik
Thx. You’re right, but the problem for me is, how can i use a temporary table in the subform ??
I don’t know if the following will be a possible, as I’m a bit short of time and don’t have time to make an example. An idea could be to make a function to pass the record to the subform, which in turn saves this variable, and uses it for its controls, tabels etc. Otherwise I’m afraid I don’t have an answer right now. Henrik
Steve: Is your question about how to assign a temporary table to the subform after the records have been filtered? Henrik is on the right track with you for passing variables to subforms, all of which I’m sure you’ll need to complete the task. For your purposes, you cannot change the source for the fields in the subform at run time. I think you’re going to need to use two subforms on your parent form. Subform #1 will be the standard subform with the source pointing to your normal table records. Subform #2 will be a copy of the first, but you will assign a variable in your C/AL Globals for the record and set the property on the variable for Temporary. You assign this variable on the source expressions for the fields in the tablebox. I believe you should put the function of creating your “filtered” records in the OnOpenForm trigger. Now from your parent form, when you select the “filtered” option, the code will hide Subform #1 and disable it. It will then unhide Subform #2 and enable it. The code in Subform #2 will perform the action of filtering the records as you require. To the end user, it will look as if the data has just changed. They won’t see the hiding and unhiding occur. I hope I understood your original question and this is helpful for you. Regards! Kristopher Webb Kelar Corporation, Canada