I have an app where I am letting users enter in a URL. For easy of use, and the ability to prompt them if they forget, I use a dropdown for them to choose the protocol (http:// or https:// ) . Then the have a text field to enter in the domain and whatever addtional directory structure. It looks like this:
Here is what I am trying to figure out. I have the above set up in my edit form. I record the domain portion in a table and concatenate the protocol to the front of that so they can see and copy the full URL. No problems here. The problem is I give them the ability to edit this record. Since the protocol is not written to the Dataverse table then, when they select the record from the gallery, the edit form only contains the domain portion. There is nothing to inform the dropdown what to select.
I am wondering what the best way might be to approach this. I was thinking maybe I write the full URL to the table and then in the edit form I can trim off the protocol and fill in the text field and somehow do the same for the dropdown by trimming off the domain portion.
Second option, and it might be the easiest, is to simply create a protocol column in the table and break out the protocol into it's own data card.
Thoughts?
@futr_vision I would recommend the second option. Since you're giving users the option to select the protocol in the first place, it would stand to reason that you will likely want them to change the protocol when editing the item (for example if they made a mistake when saving the record for the first time).
To give you a full answer, if you must over engineer things and want to avoid creating a new column, you can of course embed the dropdown control for the protocol inside the DataCard for the URL column, and then continue to Concatenate both the Dropdown selection and the URL selection into the DatCard Update property.
Concatenate(
'Your Protocol Dropdown'.Selected.Value,
'Your URL Text Input'.Text
)
You can then apply the below to the Default property of the Dropdown control to return the original protocol selection:
With(
{
_protocol: Left(
Parent.Default,
Find(
"//",
Parent.Default
) + 1
)
},
LookUp(
[
"https://",
"http://"
],
Value = _protocol,
Value
)
)
Hello! @futr_vision
I would save the protocol also to dataverse in its own column.
It's easy to save to dataverse and if the protocol doesn't need to be updated, you can just add the protocol in domain datacard as a view-only label. If it needs to be able to update, then you can just create two data cards.
I'm not sure how much does it hinder the UX but it would definetely be the easiest solution from developer side imo.
Hi @futr_vision
Shouldnt they be able to edit that too?'
So yeah store it in a column.
Agree
If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others
Cheers
Thank You
Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
https://gernaeysoftware.com
LinkedIn: https://www.linkedin.com/in/michaelgernaey
WarrenBelz
146,618
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,957
Most Valuable Professional