cancel
Showing results for 
Search instead for 
Did you mean: 

construct a string containing a command

Former Member
0 Kudos

Hi experts

please help me

Is there a way to dynamically construct code, such as:

I'd like to write a method that receives as input a string identifying a node name, and use it as follows:

wdcontext.current<InputNodeName>Element.get<AttributeName><do whatever I want>

OR

Is there a way to construct a string containing a command, and then execute it?

Such as: If I construct the following in a string by concatenating different parts of the string: wdcontext.current<InputNodeName>Element.get<AtributeName>.<do whatever I want>

Can I then pass the resulting string to some function that actually executes it?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes, this is easy, just use the generic context API. See IWDNode, IWDNodeElement, IWDAttributeInfo etc.

Armin

Answers (4)

Answers (4)

p_2_5_6_9_6_0
Active Participant
0 Kudos

Hi,

Unfortunately - there is no way to construct the command dynamically so that the command will execute. The parameters that are part of teh command may be dynamic (using Super classes and method overloading).

However, in case you want to write a single method that does all the function calling then what you need to do is:

1.) Make a context attribute that will hold some code (1,2,3 or A,B,C etc)

2.) Create the method that will read this attribute.

3.) After reading the attribute write a switch case or an if statement that will run your command.

Of course for this you will need to know all the required commands at design time.

Thanks.

p256960

Former Member
0 Kudos

Hi,

Use this:

wdContext.getChildNode(<nodename>,IWDNode.LEAD_SELECTION).getNodeInfo().getAttribute("attributename")

Now you can perform the operation that you want to on this attribute.

Regards,

Murtuza

Former Member
0 Kudos

for example

I want use parameter

String par="NodeName"

in statement - wdcontex.currentparElement.get...

former_member205363
Contributor
0 Kudos

Hi,

I understood that you wanted to do evaluation some thing and then pass that value to the function.

In this case you can take a label or InputField with invisible property and correspondingly take context attribute.

Do the manipulation what ever you want and set the value to InputField. Latter where ever you want you can access from the context.

Regards,

Lakshmi Prasad.