cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Personas: Pasting multiple values into 1 text box

0 Kudos

I have a textbox that i need to paste a User ID and User E-mail into from another transaction. I can copy them both across fine but pasting the second value always overwrites the first pasted value. Is there a way to make it so the script pastes the first value and then pastes the second value into the text box as well as it instead of overwriting it?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

cris_hansen
Advisor
Advisor
0 Kudos

Hi Kyle,

Do you have two different variables to get the values from User ID and User E-mail?

Could you elaborate on the way you get the values?

I created a flavor in SMEN to get data from SU01. Of course, I am passing the User ID, but I am retrieving the first name + last name to a "name" variable, and retrieving the email address to a "email" variable:

session.findById("wnd[0]/tbar[0]/okcd").text = "su01";

session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/usr/ctxtSUID_ST_BNAME-BNAME").text =iduser;

session.findById("wnd[0]/tbar[1]/btn[7]").press();

var name =

    session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpADDR/ssubMAINAREA:SAPLSUID_MAINTENANCE:1900/txtSUID_ST_NODE_PERSON_NAME-NAME_FIRST").text + " " +

    session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpADDR/ssubMAINAREA:SAPLSUID_MAINTENANCE:1900/txtSUID_ST_NODE_PERSON_NAME-NAME_LAST").text;

var email = session.findById("wnd[0]/usr/tabsTABSTRIP1/tabpADDR/ssubMAINAREA:SAPLSUID_MAINTENANCE:1900/txtSUID_ST_NODE_COMM_DATA-SMTP_ADDR").text;

session.findById("wnd[0]/tbar[0]/okcd").text = "/n";

session.findById("wnd[0]").sendVKey(0);

session.findById("wnd[0]/usr/lblPersonas_1459537639756").text = name;

session.findById("wnd[0]/usr/lblPersonas_1462884636830").text = email;

Kind regards,

Cris

0 Kudos

I am using Personas 2.0 and in the script i am going off to the other transaction and copying the User and then the user email in a separate step and of course then when I script to go to the actual transaction i want to paste it in I paste them in 2 separate steps as well.

former_member105930
Active Participant
0 Kudos

Hi,

You could use some simple javascript to achieve this. Copy your value as normal and call it say "user".

Use javascript such as " saveduser = args.user"

repeat for the email such as "savedemail = args.email"

When you want to paste them, again using javascript along these lines:

args.user = saveuser

args.email = savedemail

Then create a message combining both values such as:

args.message = "User name is" + args.user + " email address is " + args.email

Finally, paste the message into the resepective text field.

hope this helps,

0 Kudos

Is this within Personas 3.0? As i am using Personas 2.0 and have tried calculating that in Java script steps to no prevail, might be helpful to note i have not used Java script in personas before so would not know what i am doing.

Former Member
0 Kudos

In Personas 2 you would use a "Calculate in Javascript" step. Assuming you've copied the name into "name" and the email into "email", then the javascript step would say simply:


args.all = args.name + " " + args.email;

And the you can Paste Value "all".

Does that make sense?

Steve.

0 Kudos

Thanks a lot Steve, works perfectly, how would i go about making the second value be on a 2nd line?

Former Member
0 Kudos

Try this, it should work.

var newString = string1 + "\n" + string2;

Answers (2)

Answers (2)

former_member105930
Active Participant
0 Kudos

Like Steve has said, use the calculate in javascript function in Personas 2.(Sorry I should have said use that step in my original reply)

It does work, as it was Steve who helped me out with a very similar issue I had sometime ago.

good luck

0 Kudos

Thanks for all your help Ian

Former Member
0 Kudos

Hi, you can concatenate several strings in JavaScript for Personas 3.0 with the + operator

var combinedString = string1 + string2;

To add e.g. a blank use:

var combinedString = string1 + " " + string2;