cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AAallday
Helper I
Helper I

Combo boxes that save the searched text and add to items list

Hello

(I'm relatively novice)

Use case: i would like to put together a team project tracker with a SP list. Two of the columns will be: Category, and Project.

 

Problem: as you can imagine, users will need to add new projects and categories during their course of work. And each will need to be "reference-able" in the future (i.e. for new projects within each category, or new tasks within each project). 

 

Question: is there a to use drop down controls in a powerapps form, where user entered (searchtext) is saved to the list, and available for selection later? (I am having troubling achieving this using comboboxes (with varying challenges, having tried solutions I found online).)

 

I am willing the change the column setting to whatever is needed, of course.

 

 

BONUS: is there any way, along with all this, to make the projects dropdown choices dependent on the category? (i.e. show only the projects that match the category on the list, OR searchtext)

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AAallday ,

 

I was guessing the items of the second combo box is from a LookUp column, it's not necessary.

 

So if they are both Choice columns, it will be easier like in my last post, the project combo box will be the same as the category combo box OnSelect button:

Patch(YourList,
      Defaults(YourList),
      {
       Title:TitleDataCardValue.Text,
       Category:If(
                   IsBlank(CatDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   CatDataCardValue.Selected)
      }
       Project:If(
                   IsBlank(ProjDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   ProjDataCardValue.Selected)
      }
);
NewForm(EditForm)

 

The difference is DefaultSelectedItems of the Project combo box. As you need to auto-populate it depend on the Category combo box, you need to set to:

LookUp(Choices(YourList.Project), Value = LookUp(YourList, Category.Value = CatDataCardValue.Selected.Value).Project.Value)

 

But frankly, considering case sensitive/typos/spaces, let users manually input values is not a good idea, which will make your data source messy after a period of time. Presetting Choice column values are always a better idea.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

View solution in original post

5 REPLIES 5
v-jefferni
Community Support
Community Support

Hi @AAallday ,

 

I guess the Category column should be of type Choice and the Project column is of type LookUp, am I correct?

 

If so, then you could only update or create new items from the Edit form using Patch/Update/Collect functions, SubmitForm will be unavailable.

 

For a Choice column, you will need to activate the "manually add values" feature so that this column can accept the search text as a new option:

vjefferni_0-1651135702315.png

Then OnSelect of the submit button, assume it's the Edit form in New mode:

Patch(YourList,
      Defaults(YourList),
      {
       Title:TitleDataCardValue.Text,
       Category:If(
                   IsBlank(CatDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   CatDataCardValue.Selected)
      }
);
NewForm(EditForm)

 

For the LookUp column, it's actually getting values from another list where this column looking up to.

If(
    IsBlank(ProjectDataCardValue.Selected),
    Patch(
        Project,
        Defaults(Project),
        {Project: LookUpDataCardValue.SearchText}
    );
    Patch(
        YourList,
        Defaults(YourList),
        {
            Title: DataCardValue.Text,
            Category: If(
                IsBlank(DataCardValue4.Selected),
                {Value: DataCardValue4.SearchText},
                DataCardValue4.Selected
            ),
            Project: LookUp(
                Choices(YourList.Project),
                Value = ProjectDataCardValue.SearchText
            ),
            ...
        }
    ),
    Patch(
        YourList,
        Defaults(YourList),
        {
            Title: DataCardValue.Text,
            Category: If(
                IsBlank(CatDataCardValue.Selected),
                {Value: CatDataCardValue.SearchText},
                CatDataCardValue.Selected
            ),
            Project: ProjectDataCardValue.Selected,
            ...
        }
    )
);
NewForm(Form1)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

@v-jefferni  thanks, So the second column should be a look up type? not sure i understand why. 

 

to summarize my ask:

1. two dropdown fields (category and powerapps) in powerapps form where the search text is added to the list item, and it later included along with all other dropdown options. 

 

2. if possible, the options in the second dropdown should be dependant on the first. BUT the functionality of saving the searchtext should still work.

 

example. i have a new project. it's category will be "user interface", and the project will be "timeline". both are new so i'd have to type both in to search text which will then be saved to SP list. later i need to add a new project for user interface. so i create a new item, select "user interface" in category, now in projects only "timeline" appears, i manually type "approvals" into the field and save that to the SP list

Hi @AAallday ,

 

I was guessing the items of the second combo box is from a LookUp column, it's not necessary.

 

So if they are both Choice columns, it will be easier like in my last post, the project combo box will be the same as the category combo box OnSelect button:

Patch(YourList,
      Defaults(YourList),
      {
       Title:TitleDataCardValue.Text,
       Category:If(
                   IsBlank(CatDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   CatDataCardValue.Selected)
      }
       Project:If(
                   IsBlank(ProjDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   ProjDataCardValue.Selected)
      }
);
NewForm(EditForm)

 

The difference is DefaultSelectedItems of the Project combo box. As you need to auto-populate it depend on the Category combo box, you need to set to:

LookUp(Choices(YourList.Project), Value = LookUp(YourList, Category.Value = CatDataCardValue.Selected.Value).Project.Value)

 

But frankly, considering case sensitive/typos/spaces, let users manually input values is not a good idea, which will make your data source messy after a period of time. Presetting Choice column values are always a better idea.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

Thank you @v-jefferni 

 

i am getting an error with the above on the category onselect: Expected operator. We expect an operator such as +, *, or & at this point in the formula.

 

Also, i have seen other examples of this request, adding something to the forms "update" control. i just leave that as is?

Hi @AAallday ,

 

Sorry for some wrong operators:

Patch(YourList,
      Defaults(YourList),
      {
       Title:TitleDataCardValue.Text,
       Category:If(
                   IsBlank(CatDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   CatDataCardValue.Selected
                ),
       Project:If(
                   IsBlank(ProjDataCardValue.Selected), 
                   {Value:CatDataCardValue.SearchText},
                   ProjDataCardValue.Selected
               )
      }
);
NewForm(EditForm)

 

For your question, only when using SubmitForm on the submit button will interact with Update property of all the Data Cards, and will be very similar to the column values from in the Patch function. The difference of the two scenarios I would say is that using Patch could customize columns in a single function while using SubmitForm need to customize columns in each Data Card. But for some special controls like Attachments, it will be easier with the Update property as contents need to be in the certain structures.

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,856)