cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
efroseroc
Helper III
Helper III

Help Matching 2 Vectors

I want to create some controls that feed a single text column in my data source.

 

the result would be the following: [Jhon,Mark;Jacob] -> Text column1

And                                                 [10,50,30]              - > Text column 2

 

I want to display in another screen a dropdown with column 1 and when you select item 1 (Jhon) you get item 1 in column 2 (10).

 

Is there a way to achieve this?

 

Thanks in advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @efroseroc 

 

you can try the following:

datasource: colVector

ClearCollect(
    colVector,
    {
        name: "John,Mark,Jacob",
        values: "10,50,30"
    }
)

 

to illustrate lets add this to a gallery with source: colVector

this gallery have the following code OnSelect

ClearCollect(
    colSomeData,
    With(
        {
            _source: Split(
                Gallery4.Selected.name,
                ","
            )
        },
        ForAll(
            Sequence(CountRows(_source)),
            {
                name: Index(
                    _source,
                    Value
                ).Result,
                id: Value
            }
        )
    )
)

 the result here is a collection with the names in one column (name) and the values in another column (values)

 

Add a DropDown and set its Items to colSomeData as collected in the gallery's OnSelect above

 

Add label and set it to the follwing

Index(Split(theGalleryYouAdded.Selected.values,","),Dropdown1.Selected.id).Result

 

Result

Peek 2022-05-03 21-17.gif

 

Hope it helped 

R

 

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

View solution in original post

1 REPLY 1
rubin_boer
Super User
Super User

hi @efroseroc 

 

you can try the following:

datasource: colVector

ClearCollect(
    colVector,
    {
        name: "John,Mark,Jacob",
        values: "10,50,30"
    }
)

 

to illustrate lets add this to a gallery with source: colVector

this gallery have the following code OnSelect

ClearCollect(
    colSomeData,
    With(
        {
            _source: Split(
                Gallery4.Selected.name,
                ","
            )
        },
        ForAll(
            Sequence(CountRows(_source)),
            {
                name: Index(
                    _source,
                    Value
                ).Result,
                id: Value
            }
        )
    )
)

 the result here is a collection with the names in one column (name) and the values in another column (values)

 

Add a DropDown and set its Items to colSomeData as collected in the gallery's OnSelect above

 

Add label and set it to the follwing

Index(Split(theGalleryYouAdded.Selected.values,","),Dropdown1.Selected.id).Result

 

Result

Peek 2022-05-03 21-17.gif

 

Hope it helped 

R

 

hey there if you liked the post give it a thumbs up, and if it solved your question please accept it as a solution.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,661)