The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Token evaluation

Highlighted
LISA WILSON
Occasional Contributor

Token evaluation

Hi. PPM newbie here. I am attempting to execute the following for loop in my object type command. I want to echo the values of two package line fields:

for i in 1 2; do echo [PKG.PKGL.P.VALUE_"${i}"]; done

This is the result I get:
[PKG.PKGL.P.DEPLOY_EAR_1]
[PKG.PKGL.P.DEPLOY_EAR_2]

How do I get it to display the actual token value?

I'd appreciate any help anyone can offer. Thanks!
-Lisa
3 REPLIES
LISA WILSON
Occasional Contributor

Re: Token evaluation

Correcting the result to avoid any confusion:

This is the result I get:
[PKG.PKGL.P.VALUE_1]
[PKG.PKGL.P.VALUE_2]

Thanks!
Erik Cole
Honored Contributor

Re: Token evaluation

Hi Lisa,

The token is parsed _before_ it builds your command text. In your case, [PKG.PKGL.P.VALUE_"${i}"] is un-parsable so it just passes it as-is to the command, which then is doing the ${i} replacement and giving you the text of the token that you would've needed to pass to begin with.

I presume there's a reason for the loop, otherwise you would just

echo [PKG.PKGL.P.DEPLOY_EAR_1];
echo [PKG.PKGL.P.DEPLOY_EAR_2]

?
LISA WILSON
Occasional Contributor

Re: Token evaluation

Thanks for explanation, Erik.

We want to do the loop because we will have up to 15 fields that we will need to act upon. (Deployable EAR files.) It would just be more elegant (and save a lot of typing and chances for errors) if we could do it in a FOR loop.
//Add this to "OnDomLoad" event