1. Dave O'BILOG
  2. PowerBuilder
  3. Monday, 23 December 2019 08:57 AM UTC

Hi,

 

I'd like to save a datawindow in :

 

        yo.Object.DataWindow.Export.PDF.Method = NativePdf!
        sval = 'C:\Users\%username%\Downloads\XXX.pdf'

        // 'C:\Users\frn\Downloads\XXX.pdf' in my case
         lErr = yo.SaveAs(sval,PDF!,TRUE)

         but lerr return - 1

 

how can i find or use the variable : %username% ?

i try <username>, [username] but same result

 

thanx

Accepted Answer
Arthur Hefti Accepted Answer Pending Moderation
  1. Monday, 23 December 2019 09:18 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi

You can use the ContextService, the username is in ls_Values[1].

ContextKeyword lcx_Key
string ls_Values[]

This.GetContextService ("ContextKeyword", lcx_Key)
lcx_key.GetContextKeywords("USERNAME", ls_Values)

Regards
Arthur

Comment
  1. Dave O'BILOG
  2. Monday, 23 December 2019 09:27 AM UTC
it's good !

thanx Arthur
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.