Skip to main content

Notifications

Power Up Program - Build A Canvas App
Unanswered

How can map Choice type field with Radio button form field.

(0) ShareShare
ReportReport
Posted on by
Hi All,

I am working on a Canvas app project where i have to map a choice type table field with a Radio button selected value. But i am not able to do this i check many solution on internet but it work in my case.

Code : 

Table field = 'Rate Agitation (sos_cams_intake_rateagitation). Type = Choice of 'Agitation Rating'
Radio button of form = RateAgitation. Radio button have value as 1,2,3,4,5.
Patch(
    Counselling,
    Defaults(Counselling),
    {
'Rate Agitation (sos_cams_intake_rateagitation)' : If( RateAgitation.Selected.Value = "1", 'Agitation Rating'.'1 - Low Agitation',
                If(RateAgitation.Selected.Value = "2", 'Agitation Rating'.'2',
                    If( RateAgitation.Selected.Value = "3", 'Agitation Rating'.'3',
                         If(RateAgitation.Selected.Value = "4",'Agitation Rating'.'4','Agitation Rating'.'5 - High Agitation')
                    )
                )
            )
})

I have tried this code but got error as Value not exists in record.

If anyone have any idea please share i tried a lot but can't find any solution. please you have a code snip please share with me.

Thankyou so much
 
Categories:
  • ronaldwalcott Profile Picture
    ronaldwalcott 1,345 on at
    How can map Choice type field with Radio button form field.
    Here is a method using checkboxes, it should be similar to using a radio button
    Dropdowns appear to be the only control which interact in an acceptable manner with dataverse choice columns.

    A roundabout approach which may provide some insight is that you can use a dropdown for the update, make it invisible and use the checkbox to set the default item on the dropdown.

    e.g. I have a table called Usages and a choice called TestChecked.
    I can create the collection
    ClearCollect(testCollectionChecked, Usages);
    but I still need to get the option set from the dataverse table.
    So I can have a dropdown where the items are 
    Choices([@Usages].TestChecked)

    I can then use a checkbox and set the defaultselecteditems of the dropdown based on the checkbox
    If(CheckboxCanvas1.Checked,
    LookUp(Choices([@Usages].TestChecked),  'TestChecked (Usages)'.Yes),
    LookUp(Choices([@Usages].TestChecked),  'TestChecked (Usages)'.No))

    Not sure how the checked, unchecked are triggered so you may have to set to No for the unchecked.

    The Patch can then be based on the value in the dropdown. As a test just patching the first record.

    Patch(Usages, First(testCollectionChecked),{TestChecked: DropdownCanvas3.Selected.Value})


    Hopefully this can help in some way.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,867

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,174

Leaderboard

Featured topics