Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Get json object that start with specific text

(0) ShareShare
ReportReport
Posted on by 31

Hi everybody, 

 

I've a json with a lot of objects inside an array. i've found a way to get a specific object via this function :

outputs('Prédire_à_l’aide_de_modèles_AI_Builder')?['body/responsev2/predictionOutput/results']?[0]?['lines']?[32]?['text']
 
This function permit to get the item n°32 but sometimes the item i need can be at position 30 or 34 ou 33 or other positions.
How can i get an json object where text startWith (CLASSE) ?
 
Many thanks. 
 
Regards
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Get json object that start with specific text

    Hi @jdos3502 

     

    Glad that's you sorted with a solution but please could I request that you consider marking my response(s) as a solution, rather than your own acknowledgement for two reasons: 
    1. this forum is all about helping others, and if you don't share the answer, others will not benefit and
    2. this forum is powered by free support.  People like me do this as a hobby, we are not employed by Microsoft (yet 😋) but maybe one day.  Kudos and Solutions add to our points score and potentially allow us to be promoted to Super Users, should we meet the necessary criteria.  I believe the solution I demonstrated to you above was quite detailed and complex and ultimately gave you the flow you were looking for.

     

    Details of the Super User scheme are here https://powerusers.microsoft.com/t5/Using-the-Community/Power-Platform-Community-Super-User-Requirements/ta-p/430976

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • Verified answer
    jdos3502 Profile Picture
    31 on at
    Re: Get json object that start with specific text

    @DamoBird365 i've forgot the range 🙂 

     

    Now it's working perfectly well and take around 7sec per file. 

     

     

    Many thx 

     

     

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Get json object that start with specific text

    Hi @jdos3502 

     

    look at the repurpose array action screenshot. The expressions are in the comments. 

    you need to use range from 0 to length. And then the index is item().

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • jdos3502 Profile Picture
    31 on at
    Re: Get json object that start with specific text

    What i have to do is auto-incrementing the Index property in the Select operation 

    Maybe with an add() function ? 

    jdos3502_0-1622370961734.png

     

    Many thanks for your help. 

  • jdos3502 Profile Picture
    31 on at
    Re: Get json object that start with specific text

    Hi @DamoBird365 , 

     

    I'm confused with the select operation. 

    I'm trying to increment the index value but i don't know how to do this. 

     

    jdos3502_0-1622365355186.png

    Here's the result i get : 
     
    [
      {
        "text""FICHE DESCRIPTIVE POUR LES ADAPTATIONS AU SOL",
        "index"1
      },
      {
        "text""Section Cadastrale :",
        "index"1
      },
      {
        "text""AZ-BN9",
        "index"1
      }
    ]
     
    How can i do to get this 
    [
      {
        "text""FICHE DESCRIPTIVE POUR LES ADAPTATIONS AU SOL",
        "index"1
      },
      {
        "text""Section Cadastrale :",
        "index"2
      },
      {
        "text""AZ-BN9",
        "index"3
      }
    ]
     
    Many thanks for your help. 
  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Get json object that start with specific text

    If you replace the 2nd apply to each with a select it will be 0 seconds. It’s far more efficient. 

     

    Give it a go when you next can.

     

    Damien

  • Community Power Platform Member Profile Picture
    on at
    Re: Get json object that start with specific text

    Sorry I'm using another account as I'm not at home at this time 🙂

     

    The attachment component accept N documents. So the user can add more than one document. That's why I have to loop on each file to do AI builder.

     

    For the second loop, does the select method is more efficient than addproperty in a loop? 

     

    I'll check tomorrow morning for the flow history and get back to you but I can confirm than the most time is consumed in the second loop that add index on each items. The attachment loop is around 8-10sec per attachment.

     

    Turning on concurrency? Yes I forgot it. That's can be the deal.

     

    Thanks for your help 

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Get json object that start with specific text

    Hi @jdos3502 

     

    I'm afraid I don't understand what you are doing in the embedded apply to each actions.  Never an efficient way to do things but I am struggling to understand what you are doing.  You can turn on concurrency for both of those but if you can explain to me why, I might be able to suggest a better method.  If they are attaching 1 file, why do you have to run the AI on multiple files?

     

    You've also created variables, which are only ever needed if you are going to update them.  A compose is just as good for a temporary, one off, storage space.

     

    When you run the flow, what does the history look like?  Where is the most time consumed?  What action?

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

  • jdos3502 Profile Picture
    31 on at
    Re: Get json object that start with specific text

    Hi @DamoBird365 

     

    Thanks for your reply. 

    Do you have more details about how can i implement it with my need ? 

     

    I currently found a solution but too long for end users 

    Currently the user open a Power apps via a simple button in the CRM ribbon. 

    This power apps contain attachment control to attach PDF files.

     

    So the user attach the PDF files and click save.

     

    The Power automate is looping to all files to do a prediction with AI builder (scanning text) and it create a record in the CRM with text informations (Section cadastrale, address, ect...)

     

    Inside the attachments loop :

    1. i'm doing another loop to add index property on each items of the table (between 45 and 50 items).

    2. I'm incrementing the index number for each items.

    3. Outside the index loop, i'm doing a filter of my table to get the item where texte property equal "Section cadastrale"

    4. After that i'm using a compose to get the next index by incrementing +1 the section cadastrale index.  

     

    Here's a part of the Power automate steps i'm doing : 

     

    1. Loop on each attachment, Predict with AI Builder, Get only the concerned table of 45-50 objects in order to loop on each items to create an auto incremented index : 

     

    jdos3502_2-1622281310068.png

     

    2. Filter the created table of 45-50 objects with index to get the Section Cadastrale index. Search in the table of 45-50 objects the item that contain the section cadastrale index +1. 

    jdos3502_3-1622281546907.png

     

    This process is too long and the user must wait 40 secondes to finish the attachment process (And for only 1 attachment).

     

    Do you have another way to do this ? 20 sec per attachment can be a great deal. Or maybe by doing an asynchronous process ? 

     

    Many thanks again for your help. 

     

    Regards, 

     

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Get json object that start with specific text

    Hi @jdos3502 

     

    Did that work for you?

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here and like & subscribe to my YouTube Channel thanks 😉

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,537 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,908 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow