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

Patch text column from Dropdown Choices

Hi all,

 

I have a dropdown with the following items:

 

Items=SPInstructors.InstructorName

 

These Items are in form of text in the SPInstructors list

 

The choice of this dropdown now needs patched into another SP list named SPfeedback. The column it will be patched into is text as well. I have the following patch code:

 

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected,
        Session_detail: box_SessionDetail.Selected
    }
);
ForAll(
    col_Submit,
    Patch(
        SPfeedback,
        {
            Title: Title,
            Answer: Text(Answer),
            Stage: Text(First(Stage).Value),
            Session_Type: First(Session_Type).Value,
            Comment_Grade: Text(Comments_Grade),
            Session_detail: (Session_detail).Value,
            Instructor: (Instructor).Value
        }
));

 

The patch works fine without the last line ("Instructor: (Instructor).Value"). If I add the last line I get the error saying that it is not a record that I am putting in... any ideas where I went wrong? I think its because the dropdown is effectively a lookup from a SP list and thus the formatting might be erroneous..

 

Many thanks,

 

Tom

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

Thanks @tupues ,

If Session_Detail is working, I will leave it alone, but you are also getting a possible table here.

There are also other things possibly not needed (and you would normally have Defaults(SPFeedback) under the Patch table), but I have only changed your "problem" field here as you confirm the rest works. 

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected
    }
);
ForAll(
    col_Submit,
    Patch(
        SPfeedback,
        {
            Title: Title,
            Answer: Text(Answer),
            Stage: Text(First(Stage).Value),
            Session_Type: First(Session_Type).Value,
            Comment_Grade: Text(Comments_Grade),
            Session_detail: (Session_detail).Value,
            Instructor: col_Submit.Instructor
        }
));

As an experiment, as all the columns line up,you might also try

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected
    }
);
Collect(SPFeedback, col_Submit)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

24 REPLIES 24
WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

Hi @tupues ,

The issue is at the top - if you are wanting to collect text, then you need to specify this in the Collection. Note xxxx will depend on the Items of this control.

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected.xxxx
    }
)

will get Text values. Before I look further at the Patch, are these new records to SPFeedback?

 

tupues Helper III
Helper III

Re: Patch text column from Dropdown Choices

Thanks @WarrenBelz,

 

Yes these are new records. As mentioned all the others work without an issue, only that one dropdown is causing issues...

WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

Thanks @tupues ,

If Session_Detail is working, I will leave it alone, but you are also getting a possible table here.

There are also other things possibly not needed (and you would normally have Defaults(SPFeedback) under the Patch table), but I have only changed your "problem" field here as you confirm the rest works. 

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected
    }
);
ForAll(
    col_Submit,
    Patch(
        SPfeedback,
        {
            Title: Title,
            Answer: Text(Answer),
            Stage: Text(First(Stage).Value),
            Session_Type: First(Session_Type).Value,
            Comment_Grade: Text(Comments_Grade),
            Session_detail: (Session_detail).Value,
            Instructor: col_Submit.Instructor
        }
));

As an experiment, as all the columns line up,you might also try

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected
    }
);
Collect(SPFeedback, col_Submit)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

tupues Helper III
Helper III

Re: Patch text column from Dropdown Choices

Thanks @WarrenBelz 

 

Tried the above. However if I add ".InstructorName" to 

Instructor: box_Instructor.Selected,

---->

Collect(
    col_Submit,
    {
        Title: "Comments",
        Answer: CommentsInput.Text,
        Instructor: box_Instructor.Selected.InstructorName,
        Session_detail: box_SessionDetail.Selected
    }
);

I am getting the "incompatible type" error saying that the "function collect has some invalid arguments"...

 

 

WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

Thanks @tupues ,

Obviously I cannot see either your data or control specs, but you did say earlier that the drop down Items was 

SPInstructors.InstructorName

are we referring to the same drop-down? Please confirm that this is definitely the Items property. Also when you type box_Instructor.Selected. you should see the valid options underneath - what are they?

tupues Helper III
Helper III

Re: Patch text column from Dropdown Choices

Thats correct. 

 

Items=SPInstructors.InstructorName

 

 

Below find a screenshot; also see the suggestion it is giving. Instructor Name is there as you can see, but it still gives me the error.

 

Screen Shot 2020-04-04 at 13.43.01.png

 

Thanks for your help!

WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

Hi @tupues ,

It should be

SPInstructors.'Instructor Name'

 

tupues Helper III
Helper III

Re: Patch text column from Dropdown Choices

Tried that, but it doesn't change anything unfortunately. I put InstructorName because it's the actual column name...

 

Thanks ever so much for the quick help!

WarrenBelz Community Champion
Community Champion

Re: Patch text column from Dropdown Choices

OK @tupues ,

This really should not be hard - you simply need to match the output to the data type required at the target and this as you have mentioned is Text. It all comes down to getting a text value from the drop down, which should be easy if you refer to what the user selects, which is ddName.Selected.xxxx where xxxx can be Value for a Choice field, Result for a Distinct filter or (in your case) the name of the field presented.

I am sorry to ask this question again, but the Items property - is it

SPInstructors.InstructorName

as I said or

Items=SPInstructors.InstructorName

as you said 

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (8,597)