Illogical error when working with temporary records

I’ve tried running a report over temporary records using report.SETTABLEVIEW(temporaryvariable), being temporaryvariable the same record type as the report is based (the same as it’s dataitem), and when running that code it crashes and tells that there’s no dataitem of type Recordtype on that report. If changed the variable to non temporary, the code works fine (but the data on it is not the one i wanted to have). I tested it on Navision 2.60 inclusively by creating a test table with just a field (field test ,code 20),a simple wizard report on it and a form with two buttons, one for calling the settableview with a temporary record of the test type and the other one with a non temporary record of the same type. Results: SETTABLEVIEW worked on the non temporary record and gave me an error when trying with the temporary one… ¿ Has someone else experienced something similar? Anybody knows a way for doing it without having to pass the temporary table through a function and then working with it on the report? (i’m would like not having to modify the report, that is working fine for other things…). Regards, Alfonso Pertierra Spain

I can assure you that I use this method to call reports very often and NEVER was running in a problem like you describe. I think your approach to use a temporary record variable is wrong. I never tried that and cannot imagine a situation where this should be neccessary. Temporary Variables are only local for the object where you defined them and you cannot pass them as parameters. Proceed as follows: 1) Define your Record as local or global variable in your form. 2) Set Filters, Ranges etc. on this record 3) pass the record to the report. A typical scenario would look like this: myRec.reset; myrec.setrange(id, some_id); myrec.setrange (postingdate,0d,today); myreport.settableview(myrec); Marcus Fabian phone: +41 79 4397872

Don’t worry, Fabian, i just was surprised by the way Navision uses things. About why i’m using temporary tables in some processing code it’s very easy of understanding: Sometimes i want to keep a “log” of some of the records of a table, records that i just know after executing a testing code.(example: you want to know all the records in a table that match some conditions wich result must be obtained by code after a few processing… or not so few… :wink: ) When, for example, registering from Sales by packs (don’t know how it’s called in the International version “Registrar por lotes”… taking lots of sales for registering using a filter all at the same time). I was creating a process that after testing some credit conditions, let the sales broachment be registered or not, copying the not registered to a temporary table (as i was prompted to obtain a report from those records). After doing that, i’m able of setting that temporary table as tableview of a form (it works fine), but not as tableview of a report (dunno why…). I solved it creating the temporary table on the report and using a pair of functions for initializing and filling it… and then an integer dataitem that shows the records info (setfilter(number,’%1…%2’,1,temporarytable.count))… but it can be easier (and would let me use the report for more things than just for my process) if using the Tableview. I know i could use an array (but not a good way as i don’t know how many records i should got) or marked the records and then showed just marked ones (but that gaves me conflicts with other processing…) so that’s why i used temporary ones (they can be really usefull in some cases). Seeyas, Alfonso Pertierra Spain

You can indeed pass temporary variables of type record to for instance a form. This should increase performance, e.g. when dealing with matrix-forms presenting only a subset of records, being that the data is kept in client memory, and only has to be fetched once from the database. Regards

About this fail we’ve received the answer from navision support and they told that it’s a fail on Navision working that has been reported to Denmark and hope should be corrected in future releases of Navision… Alfonso Pertierra Spain

Re: >>fail on Navision working that has been reported to Denmark and hope should be corrected in future releases of Navision…<< Hmm, guess I had hear that statement many times before on maaaany subjects :slight_smile: Marcus Fabian phone: +41 79 4397872