web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Power Automate Desktop
Answered

Getting input list first item (List[0]) into a variable

(0) ShareShare
ReportReport
Posted on by 4
Hello!

I'm new to the Power Automate Desktop program.


Here's my problem: (Updated)

I use Power-Fx, which needed in a later part of the flow, so I can't make a new flow without it.
 
I have an list input inside my desktop flow.
(I created it, by choosing the list datatype. Then in the values Edit field, I switch on the JSON-editor, and entered the following: ["Alpha", "Beta", "Gamma"]).
This is an example list, but the real data list can have a different length (it can be less or more items).

After this I use the "Set Variable" step, to make a new variable. In this variable I want to get the first item from my list. (So I need something like "ListName[0]", which should give me the "Alpha" text back.) - Technically I will need to get every items, by the index, so the index will be a variable, that I will change with a special logic. (Not a simple for-each function).
However, when I try it somehow either gives me the the exact text ("ListName[0]"), or give an error message ("Invalid characters...").
The for-each loop with the current item is not really a solution for me, as the remaining part of the flow uses another for-each. (So this two "loops" should work together,  something like this: A_List[0] B_List[0], then A_List[1] B_List[1], etc...).

I tried a few things, including the %ListName[0]% command, which a lot of other videos and forums says, but nothing worked so far.

About the screenshots. Where I work, we have a strict policy against sharing sensitive data, and the flow (input list) contain these data. That's why I can't share screenshots.
Sorry about it guys!


If you can help me, or give me some guide, I would be thankful!

~ Rob
Categories:
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,133 Super User 2025 Season 2 on at
    Getting input list first item (List[0]) into a variable
    When you can always include a screenshot of the flow, as it provides helpful context.

    I think you might have Power Fx enabled flow and if so then %ListName[0]% is not correct syntax as it would be in normal non-Power Fx flow. So either recreate the flow without Power Fx enabled or use first() -expression.

    In Power Fx you need to use Power Fx expressions to get certain item from a list. Write =First(ListName) into the Set variable action
  • RB-17111346-0 Profile Picture
    4 on at
    Getting input list first item (List[0]) into a variable
    Hi!

    I realized I forgot to mention a few things, so I updated my question.

    Sincerely,
     ~ Rob
  • Verified answer
    eetuRobo Profile Picture
    4,133 Super User 2025 Season 2 on at
    Getting input list first item (List[0]) into a variable
    Hello,

    You can use Index() -expression. 
    Power Fx is 1 based index so first item is 1 unlike in normal PAD flow its 0 based indexing where first item would be 0.

    So use =Index(ListName, 3) to get the third item from the list.

    Like so:


    Don't mind the warning "Warning: Deferred type provided". That seems to come when you refer to input variables with Power Fx enabled. But if you would create the list in the editor it would not give that error. Like so:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 555 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 388 Moderator

#3
chiaraalina Profile Picture

chiaraalina 264

Last 30 days Overall leaderboard