cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thiago_Cruz_McF
Frequent Visitor

Using variable as a column on Collect function

Hi there!

 

Is there a way I can use a variable (With function) as a column on a Collect function?

 

For example:

 

 

 

With(
    {SkillChosen: TextInput.Text},
    Collect(
        'MyList',
        {
            Title: TitleInput.Text,
            EmployeeName: MailInput.Text,
            SkillChosen: SkillSet.Selected
        }
    )
)

 

 

 

 

I would like the "SkillChosen" variable to define which column would be the chosen to storage the text from the "SkillSet" text input. When I try to do it, the platform says that "The SkillChosen column doesn't exist". Yes, it doesn't exist, but the variable does. Can the Collect function read variables in place of the column's name?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
yuxi666
Microsoft
Microsoft

Hi @Thiago_Cruz_McF 

 

All apps and data sources in PowerApps need to respect the data schema, and that cannot be enforced if strings are allowed to be used to identify column names.

 

I am not sure how you have set your variable, however, you can use one label to test whether

SkillSet.Selected

shows error or not.

 

1.if SkillSet is one text input control,please change the code as:

Collect(
'MyList',
{
Title: TitleInput.Text,
EmployeeName: MailInput.Text,
SkillChosen: SkillSet.Text
}
)

2.If SillSet is one variable,change the code as:

Collect(
'MyList',
{
Title: TitleInput.Text,
EmployeeName: MailInput.Text,
SkillChosen: SkillSet
}
)

 

You can also reference this case: Dynamic-Collect-column-name 

 

Best Regards.

yuxi

 

View solution in original post

1 REPLY 1
yuxi666
Microsoft
Microsoft

Hi @Thiago_Cruz_McF 

 

All apps and data sources in PowerApps need to respect the data schema, and that cannot be enforced if strings are allowed to be used to identify column names.

 

I am not sure how you have set your variable, however, you can use one label to test whether

SkillSet.Selected

shows error or not.

 

1.if SkillSet is one text input control,please change the code as:

Collect(
'MyList',
{
Title: TitleInput.Text,
EmployeeName: MailInput.Text,
SkillChosen: SkillSet.Text
}
)

2.If SillSet is one variable,change the code as:

Collect(
'MyList',
{
Title: TitleInput.Text,
EmployeeName: MailInput.Text,
SkillChosen: SkillSet
}
)

 

You can also reference this case: Dynamic-Collect-column-name 

 

Best Regards.

yuxi

 

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,926)