3

I have a list:

@{IFUP}  10  20

I want to modify only one of those values, e.g:

${IFUP}[${idx}]=  Set Variable  30

where $idx is 0

This produces No keyword with name ''${IFUP}[${idx}]='. Same happens with direct ${IFUP}[0] assignment.

RobotFramwork version is 3.1 (list syntax is a bit different).

I would be happy with a variable variable solution like: ${IFUP_${idx}}= but this produces the same error.

Suggestions?

2 Answers 2

4

You can use the 'Set List Value' keyword from Collections library.

In your case, it should be

Set List Value  ${IFUP}    0    30   

http://robotframework.org/robotframework/latest/libraries/Collections.html#Set%20List%20Value

Sign up to request clarification or add additional context in comments.

Comments

1

Please check below code:

List_at_place_change
    @{IFUP}    Create List    10    20
    Log    ${IFUP[0]}
    Set List Value    ${IFUP}    0    30
    Log    ${IFUP}

1 Comment

Hi, this just creates a new variable named "IFUP[0]" which is different from the original. If you use "Log ${IFUP}" you will get the original values, 10 20.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.