cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FelipeCaru
Advocate V
Advocate V

Edit view / add field: Select or add new one

Hello all,

I have yet another question that I am not sure if it is possible to do or not.

In my edit screen, which I can see from either Detail>Edit entry or by adding a new entry, I want to be able to have the option to either write a new "title" or selecting from one already created. I know it sounds confusing, maybe, so, in images.

view1_forum.png

In my entry view, I have a list of projects to choose from, and shows the task I have yet to do. Keep in mind that project list. Now,

view2_forum.png

This is edit/new entry view. In this one, on the data that is on the red square, I have to add to what "project" it belongs, or type a new one if it is, well, new. So what I want to know is if it is possible to there choose from one that already exists from list or write new one, if needed; or perhaps write project name and give suggestions of name that already exists; if it doesn't exist, say "no match" in the suggestion field.

So:

  • Select "title"/project from list or write new one
  • Select "title"/project from suggested list when typing or write new one

 

Thanks in advance,

5 ACCEPTED SOLUTIONS

Accepted Solutions

@FelipeCaru 

So, yes, the "formula" I stated was in theory - you needed to adjust to your actual form and control names.

Did you add a ComboBox to your form?  That would be the first step.

 

If this is part of a Form, you will need to unlock that datacard and insert a ComboBox and replace the control type (as combo box is not available in the pre-sets).

 

So, I pre-tested this example.  I have a Form called Form1.  It is tied to a datasource.  I have a Title field on it.  Here are the steps I took:

1) Unlock the Title_DataCard1

2) Insert a ComboBox - my datacard now has StarVisible1, ErrorMessage1, DataCardKey1, DataCardValue1, and now ComboBox1

3) Delete the DataCardValue1 control - (up pop red x's becuase you've pulled a component needed out...not to worry)

4) Rename your ComboBox1 to DataCardValue1 - (red x's go away)

5) Choose the ComboBox now called DataCardValue1

   a) set the Allow Multiple Selections to Off

   b) set the Allow Searching to On

   c) set the Items to Parent.AllowedValues

   d) set your InputTextPlaceHolder to whatever you want the hint text to be.

6) Choose the Title_DataCard1

   a) set the AllowedValues to - RenameColumns(Distinct(dataSource, Title), "Result", "Value") (This rename saves us steps in dealing with the distinct function results)

   b) set the Update to:

        If(!IsBlank(DataCardValue1.Selected.Value), // ComboBox has a selected value? 

           DataCardValue1.Selected.Value, // Then use it.
           DataCardValue1.SearchText)  //Otherwise use the search text

 

You now have the ability to have people choose an existing Item title in your datasource or enter their own.

 

Hope this is clear and helps.

Sorry that some of these names may be different in Spanish.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@FelipeCaru 

ARGGGHHH - I just realized what I neglected to tell you!!!

I've been siting here typing out a big long response and following my steps against your photo and it just dawned on me...

STEP 1 should have been.

Before you unlock your datacard - change the Control Type to "Allowed Values"

I don't believe you can change it after you've unlocked.  So, sorry I neglected to mention, but you'll have to add that Title field back into your Form and change its Control Type, Then Delete the custom DataCard as it's not working.

NOW...resume the process with the previous Step 1.

Lo siento! 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@FelipeCaru 

You'll need to always adjust your Formulas based on your own app names.  If I've put "dataSource" in a formula, that's just a representation that this is where you put YOUR datasource.  It appears from your photos, that it is called demo_project

I am also assuming now that your DataCardValue1_1 has been deleted and you are now working with DataCardValue18.

 

So, from what I see, your formula should be:

   RenameColumns(Distinct(demo_project; Title); "Result"; "Value")

 

The Update formula error should go away once the above is corrected.

 

Let's see if we get you there in this one...

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@FelipeCaru 

Double check your properties on the DataCardValue18 combobox control.

 

Make sure you have the following:

   Allow Multiple Selections to Off

   Allow Searching to On

   Items to Parent.AllowedValues

   Default to  {Value:ThisItem.Title}

   InputTextPlaceHolder to whatever you want the hint text to be.

   DisplayFields and SearchFields to ["Value"]

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@FelipeCaru 

Perhaps good for a laugh to conclude this for you...

I didn't notice it before, but you have quotes around Title in your distinct statment (RenameColumns(Distinct(demo_project;"Title");"Result";"Value") ) so guess what...you're only going to have "Title" in your results Smiley LOL

 

So, change your AllowedValues to:

  RenameColumns(Distinct(demo_project;Title);"Result";"Value")

 

And you *should* be good.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

21 REPLIES 21
RandyHayes
Super User
Super User

@FelipeCaruhola again...

Have you looked at the ComboBox control?  This would allow you to have a list to choose from and also alow type-in values.  If the user types something in, the ComboBox will have a SearchText value that you can use for your title.  If they choose an existing Title, that will be in the Selected.Value

 

Hope this help.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I am not sure if a ComboBox would help, @RandyHayes since one part of the problem is solved, which is choosing one of the existing one. But would it let me type and keep one that does not exist in the list?

@FelipeCaru 

If I understood you correctly - you are trying to provide a Title (project) field that the user can either choose an existing Title/Project or enter in a new one.

Without throwing a bunch of controls at it, you have a could of one-control choices to narrow down:

DropDown - Would show your existing Title/Projects, but no way to enter new.

ListBox - Would show your existing Title/Projects, but no way to enter new and takes a lot of space.

ComboBox Would show your existing Title/Projects, and User can enter new and takes standard space of a text field or dropdown.

 

So, let go with a ComboBox!  (let's call it ComboBox1)

First, it would have to allow searching (AllowSearching property).

Set the Allow Multiple Selections to off.

You can change the "Hint Text" in that control by changing the InputTextPlaceHolder property.

 

Then, when updating your data, you would have to check a condition - that would be is there and item selected or text in the box?  And what if there is both?  On that question, I am going to assume you would use the Selected value over the typed value.

 

(note - this is theory formula - you will need to adjust to your app)

 

If(!IsBlank(ComboBox1.Selected.Value);        // If there is a non-blank value in the selected item i.e. a selected item

   Title/Project = ComboBox1.Selected.Value;   // then set the title/project to that value

   Title/Project = ComboBox1.SearchText     // otherwise, set it to the search text

 

AND, of course you would want to put a condition on all of it to make sure that either an item is selected or that text has been typed.

 

Hope this sheds some more light on it. 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

I'm not sure what I am doing wrong since it shows nothing on it, not even the help text since it is blank (even if I added help text to it).

It might be because I am not sure what the entire formula does.

If(!IsBlank(ComboBox1.Selected.Value);Título=ComboBox1.Selected.Value;Título=ComboBox1.SearchText)

For starters, the errors I get from this are:

- Function "IsBlank" has not valid arguments

- Whole formula: Property expects Table values, but this rule generates boolean values non compatibles

- Título: Name is not valid. Can't recognize identifier. This shows up if it refers to element that does not exist anymore (example: erased controller)

- .Value: same error as above

 

What am I doing wrong? As additional info, the "project name" is from the "Título" column.

@FelipeCaru 

So, yes, the "formula" I stated was in theory - you needed to adjust to your actual form and control names.

Did you add a ComboBox to your form?  That would be the first step.

 

If this is part of a Form, you will need to unlock that datacard and insert a ComboBox and replace the control type (as combo box is not available in the pre-sets).

 

So, I pre-tested this example.  I have a Form called Form1.  It is tied to a datasource.  I have a Title field on it.  Here are the steps I took:

1) Unlock the Title_DataCard1

2) Insert a ComboBox - my datacard now has StarVisible1, ErrorMessage1, DataCardKey1, DataCardValue1, and now ComboBox1

3) Delete the DataCardValue1 control - (up pop red x's becuase you've pulled a component needed out...not to worry)

4) Rename your ComboBox1 to DataCardValue1 - (red x's go away)

5) Choose the ComboBox now called DataCardValue1

   a) set the Allow Multiple Selections to Off

   b) set the Allow Searching to On

   c) set the Items to Parent.AllowedValues

   d) set your InputTextPlaceHolder to whatever you want the hint text to be.

6) Choose the Title_DataCard1

   a) set the AllowedValues to - RenameColumns(Distinct(dataSource, Title), "Result", "Value") (This rename saves us steps in dealing with the distinct function results)

   b) set the Update to:

        If(!IsBlank(DataCardValue1.Selected.Value), // ComboBox has a selected value? 

           DataCardValue1.Selected.Value, // Then use it.
           DataCardValue1.SearchText)  //Otherwise use the search text

 

You now have the ability to have people choose an existing Item title in your datasource or enter their own.

 

Hope this is clear and helps.

Sorry that some of these names may be different in Spanish.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Actually...did some more review on this (sorry was rushing through a solution for you).

While this will get you close to what you want. The issue comes in when you are Editing an existing record.

There is no way to set the search text through formula.  So, you would also need to put on the DefaultSelectedItems property of the combobox in your data card the following:

   {Value:ThisItem.Title}

Ultimately, this will work, but I could see issues if the values somehow don't match.

Your final solution may be to put both a dropdown and textbox in the data card and set the visibility and other properties based on the conditions of the record (new, edit, etc)

 

I believe you'll need to experiment with what works best for you.

 

Hope this is a fun journey.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

I got some errors that it seems make it not work at all. The errors I have are:

- Parent.AllowedValues has error of "not valid name, identifier not recognized" (X more "inside")

- DataCardValue1_1.Text has same error (X more on the outside)

- Can't find the "allowedvalues" of the datacard, see:

errorComboBox1.png

 

- And lastly, after using the UPDATE formula, it shows it whole in error:

errorComboBox2.png

3 errors translated are:

- Function IF has some arguments not valid

- Function IsBlank has some arguments not valid

And on top of  the part with ".Value", it says:

- Name not valid. Can't recognize identifier. Normally shows up when formula references an element that doesn't exist (for example, erased controller).

 

Thanks for any help,

@FelipeCaru 

ARGGGHHH - I just realized what I neglected to tell you!!!

I've been siting here typing out a big long response and following my steps against your photo and it just dawned on me...

STEP 1 should have been.

Before you unlock your datacard - change the Control Type to "Allowed Values"

I don't believe you can change it after you've unlocked.  So, sorry I neglected to mention, but you'll have to add that Title field back into your Form and change its Control Type, Then Delete the custom DataCard as it's not working.

NOW...resume the process with the previous Step 1.

Lo siento! 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

Ha, no worries, happens to anybody.

 

Anyway, still no luck. Errors are now the following:

errorCombobox11.png

This ones from the "AllowedValues" formula.

I also tried with:

RenameColumns(Distinct(DataSourceInfo(demo_project; DataSourceInfo.AllowedValues; "Title"));"Result";"Value")

But that one says that it was expected 2 values and was given 3.

 

The IF part, tho, in Update:

If(!IsBlank(DataCardValue18.Selected.Value);DataCardValue18.Selected.Value;DataCardValue18.SearchText)

Says errors of:

- If/IsBlank has not valid arguments, and that .Value is not valid.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,800)