I have a data entry form based on a SharePoint list.
'Staff Name' is a Combo box field (office365 users) and 'Issued to OR received from' is a text and a required field. Sometimes we have to issue material to the individuals who are not the organisational staff, hence, the reason for a separate text field.
What I would like to do is, if I select staff from 'Staff Name' field, it should copy the name to the 'Issued to OR received from' field. However, if I leave the 'Staff Name' field blank, I should be able to manually enter name of the individual in 'Issued to OR received from' field.
I have tried the Patch function in the OnChange property of 'Staff Name', while watching Shane Young video, unfortunately it did not work for me. Most probably I did not follow it properly.
Any assistance would be highly appreciated.
You can follow these workaround without using the textbox. That is if the user types in the combobox a name that is not in the list or not, it will be saved:
1. OnStart:
ClearCollect(MyUsers,Office365Users.SearchUser({searchTerm:""}).DisplayName)
2. On the Items of the ComboBox
MyUsers
3. If you are using a Patch function:
Patch(Datasource, Defaults( Datasource),
{ Name: If(IsBlank(ComboBox4.Selected),
ComboBox4.SearchText,
ComboBox4.Selected.DisplayName)})
4. If you are using a form, On the Update property:
If(IsBlank(ComboBox4.Selected),
ComboBox4.SearchText,
ComboBox4.Selected.DisplayName))
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
I would use the fur the text field the displaymode'if(IsBlank(ComboBox4.Selected),edit,view)' and for the default text it this 'ComboBox4.Selected.DisplayName)'
If the issue Resolved?
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
@eka24, thanks a lot for taking time to respond to my query, appreciated.
StaffName (Combo Box) is not a required field, "Issued to or received from" text box is a required field, reason being on a frequent basis we have to issue material to the contractors who are not staff, therefore, I would like to keep both fields. What I really want is if the material is being issued to a staff, the data entry operator enters staff name in the Combo Box, which will update the "Issued to or received from" text box. If he material is being issued to a contractor, data entry operator will bypass Combo Box and enters the name in the Text box field.
Can you show the full formula you are using for the Patch?
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Below is the formula:
Patch(CovidCOVID_19_Issuance_Receipt,ThisItem,{'Issued to OR Received from_DataCard4_1': ddStaffName1.SelectedText.Value})
Combo Box: ddStaffName1
Text Box: IssuedReceived1
Patch(CovidCOVID_19_Issuance_Receipt,ThisItem,{'Issued to OR Received from_DataCard4_1':
If(IsBlank(ddStaffName1.Selected),IssuedReceived1.Text,ddStaffName1.SelectedText.Value)})
or
Patch(CovidCOVID_19_Issuance_Receipt,ThisItem,{'Issued to OR Received from_DataCard4_1':
If(IsBlank(ddStaffName1.Selected),IssuedReceived1.Text,ddStaffName1.Selected.Value)})
Are you Patching from a Gallery?
Meaning if user does not enter in the Combobox, it will patch the Texbox: IssuedReceived1.Text
If you still have issues, kindly show the Items on the Combobox.
------------
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Thanks again. There's no Gallery in this app, see below snapshot of the SP list:
I entered the formula in the OnChange property of Combo Box, however, received below error message:
User | Count |
---|---|
119 | |
86 | |
83 | |
74 | |
69 |
User | Count |
---|---|
215 | |
179 | |
140 | |
108 | |
83 |