Skip to Content

pb7 setvalue for compute field not working

Friends,

string ls_user

ls_user=get_user();

messagebox("test",ls_user)   ====== this is working..

i tried with two different ways...both are not working..the dw_1 is in the crosstab report.

i want to send this user name either to the compute field or to the datawindow query directly in the where condition...

whichever is possible , pls provide me the solution.

dw_1.SetItem(1,'compute_1',ls_user)   ==== Not working

dw_1.object.compute_1.expression="'"+ls_user+"'"  === Not working..

thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jan 10, 2015 at 07:15 AM

    instead of the compute_1 use a static text

    dw_1,modify ( 'st_user.text="' + ls_user + "' )

    Add comment
    10|10000 characters needed characters exceeded

    • Addition:

      I don't know MS SQL Server but it may be, that the username in SYSTEM_USER is not in same case as in SQLCA.LogId. So it may be that you have to convert the mentor (e.g. to uppercase).

  • avatar image
    Former Member
    Jan 11, 2015 at 09:10 PM

    Try this:

    ls_mod = 'compute_1.Expression=~"String(~''+ls_user+'~')~"'

    dw_1.Modify(ls_mod)

    hth,

    Neil

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 20, 2015 at 10:31 AM

    Hi.

    If you want to put a variable in the Where clause without an additional script to retrieve or any retrieval argument, you can create a database function to return the user name then call this function in the Where clause:

    SELECT col1, col2

    FROM STUDENT

    WHERE MENTOR = get_user();

    Regards,

    Luiz

    Add comment
    10|10000 characters needed characters exceeded