Filter on GUID

fvefve Member Posts: 28
Hi,

I would like to know if it's possible to set a filter on a GUID-field in a table.

I have created a table with a GUID-field.
I use this table in a report.

In the OnInitReport-trigger, I call the function CREATEGUID().
Then I write records to the table above with the GUID as one of the fields.

Then, in a new dataitem, I perform a SETRANGE on the GUID in the OnPreDataItem-trigger, in order to filter only the records added to the table in this particular run of the report.

Unfortunately, this leaves me with an empty report.

If I remove the SETRANGE on the GUID in the OnPreDataItem-trigger, the report runs correctly. The only problem I have, is that multiple users can run this report at the same time, so data is mixed up. I don't see another solution than using the GUID to solve this problem.

Any help is appreciated.

Answers

  • krikikriki Member, Moderator Posts: 9,118
    It is better to use temptables for the report. With temptables you don't write to the real DB, but keep it in memory, so it is faster and if users use the same report at the same time, they don't interfere.
    See http://www.mibuso.com/howtoinfo.asp?FileID=6 for reports based on a temptable.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • kinekine Member Posts: 12,562
    And if you still need the real table inserts, please, post your code for the setrange...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,118
    kine wrote:
    And if you still need the real table inserts, please, post your code for the setrange...
    Or even better:use the session id (that is an integer):
    recSession.RESET;
    recSession.SETRANGE("My Session",TRUE);
    recSession.FIND('-');
    MESSAGE('%1',recSession."Connection ID");
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • fvefve Member Posts: 28
    Thank you for all the replies.

    I managed to get it working with the temp. table!

    Thank you all for your help!
Sign In or Register to comment.