learner
10th March 2004, 19:58
Hi,

I have 3 customized sessions.

First session is a Maintain session through which temp. table get populated and unique key is "Invoice no."

Second session is a print session which does printing based on the Invoice No. specified on the form.

and Third session is a display sub-session ( Form Type 2 ) which is attached as zoom to the Invoice field on the Print Session.

Now my doubt is that i want to show only those Invoices which were created by the respective user. So to be more precice user "X" cannot see the Invoices created by user "Y" in the display sub-session.

So question is how can i prevent all the Invoices to appear for every user ?? I want to show Invoices to the current user which he created and not the invoices which other people created.


This display sub-session, i generated through standard session "Generate Session" and haven't written any code for this.

Any help/hint would be helpfull.


Regards

Learner

tomlbacon
10th March 2004, 20:36
One way would be to keep the USERID of the user that enters the invoice and then only display invoices created by the current USERID.

lbencic
10th March 2004, 21:55
I think the user who created the invoice would be the user stored on the history table (tdsls051 on Baan IV). Record type = 3 is for invoiced. So, (in theory) you could add a read to that table for the invoice number / record type = 3 / user = logname$ to a query.extension for your new sub session, then it would not select the records not of your logged in user.
logname$ gets the userid too, I haven't used USERID, probably the same.

learner
11th March 2004, 19:50
Hi,

Well yes i am capturing the user name in my customized table, i wrote the following code in before.program of my display session


string curr.user(20)
query.extension = "tdsgf005.user = curr.user"


With the above piece of code it throws error as soon as i zoom to this display session as "Query expression not correct".

and if i do the following changes


string curr.user(20)
query.extension ="tdsgf005.user = 'curr.user'"


cur.user is treated a string and the value inside that variable doesn't come up .

How to solve this, should i hard code the user names ?

Regards

Learner

lbencic
11th March 2004, 20:36
Try a couple of things first:

1. I had to make my variables external to use in a query extension. No idea why. So declare curr.user as external in the declaration section:

extern domain tcmcs.str20 curr.user

2. Use the colon in front of curr.user when checking:

query.extension = "tdsgf005.user = :curr.user"

learner
12th March 2004, 19:47
Hi,

Thanks , it worked, i made that variable as extern and also inserted : in front of variable.

cheers

Regards

Learner