cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
juan_urena
Level: Powered On

fill collection with 2 strings

hi im trying to fill a collection  like this:

 

Collect(
riesgolist;
{
riesgo: DataCardValue24.Text;
consecuencia: DataCardValue25.Text
}
)

 

and i have this 2 strings:

stringRiesgos ="riesgo,problema,error"

stringConsecuencias="consecuencia,error,problema"

 

and i like with stringRiesgos fill just riesgo and with stringConsecuencias fill consecuencias

 

i use this code :

Clear(riesgolist);;
ClearCollect(
riesgolist;
ForAll(
Split(
"riesgo,problema,error";
","
);
{riesgo: Result}
)
)

 

but i can find how to fill consecuencia, anyone know how to do that?

thanks!!

6 REPLIES 6
Super User
Super User

Re: fill collection with 2 strings

@juan_urena 

Can you please what data you want the collection riesgolist to have once populated?

juan_urena
Level: Powered On

Re: fill collection with 2 strings

the kind of data will be string, and i whant to split my 2 string separate with commas and fill the collection and then fill a gallery in the picture is what i want to do 

Super User
Super User

Re: fill collection with 2 strings

@juan_urena 

Perhaps I am misunderstanding you but do you want to create exactly the collection in your picture?

 

ClearCollect(
    reisgolist;
    {stringRiesgos: "riesgo", stringConsecuencias: "consecuencia"};
    {stringRiesgos: "problema", stringConsecuencias: "error"};
    {stringRiesgos: "error", stringConsecuencias: "problema"}
)

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
juan_urena
Level: Powered On

Re: fill collection with 2 strings

well i need to load the data in the collection 

i will recibe the variable stringRiesgo and stringConsecuencia and it will have strings like stringRiesgo="option1,option2,opcion3"  that 2 strings (stringRiesgo and stringConsecuencia ) will be diferents depending of other configurations,i need split my strings and each element fill in my colection 

By example i receibe

stringRiesgo="option1,option2,opcion3"  and stringConsecuencia="consecuence 1,consecuence 2,consecuence 3"  

 

and i like to split each string and each element load in collection

 

I need that each element of my strings splited to be filled in the riesgo and consecuencias fields from my riesgoList

 

riesgoList(

{  riesgo:"option1";

consecuencia:"consecuence 1"

};

{  riesgo:"option2";

consecuencia:"consecuence 2"

};

{  riesgo:"option3";

consecuencia:"consecuence 3"

}

)

the problem is that my 2 variables (stringRiesgo and stringConsecuencia ) will be always diferents so i can't  set by default on my collection

 

Super User
Super User

Re: fill collection with 2 strings

@juan_urena 

Sorry, but I do not understand what you are trying to do.  You might want to re-post your question so another forum member will take a look at it.

juan_urena
Level: Powered On

Re: fill collection with 2 strings

ok don´t worry, thanks for your time 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (2,753)