Hi everyone,
I'm making some improvements to a timesheet app I've built and I've hit a dead-end with how to solve a problem I've come up against.
I'm adding a new field to my app called "Timesheet Type", which is a choice column through which the user can select one of the following options:
- Standard
- Holiday
- Sick
If they select "Standard", all of the fields are displayed for them to fill out, e.g. start time, finish time, worksite name, etc.
If they select "Holiday" or "Sick" then I am wanting to hide most fields (apart from Date and Type) and fill in preset data for all of these hidden fields.
As an example, if the user selects "Holiday" it would set Start Time Hour to "07", Start Time Minute to "30", Work Site to "Holiday" etc. and hide these fields from them.
This works fine for "Work Site", which is a text column that I add the word "Holiday" to. What I have an issue with is getting it to select the choice in the combobox and save it. Here is my code for the Start Time Hour data card, defaultselecteditems property:
If(DataCardValue5.Selected.Value = [@'Timesheet Type'].Holiday, ["07"],
If(DataCardValue5.Selected.Value = [@'Timesheet Type'].'Sick', ["07"],
[Parent.Default]))
DataCardValue5 = Timesheet Type combobox
[@'Timesheet Type'] = The choice/option set
So when I select "Holiday" in the Timesheet Type combobox, it shows the below:
But even though the combobox for Start Time Hour looks like "07" is selected, it actually isn't, and therefore when the timesheet is submitted these fields are left blank:
As you can see above, the combobox looks like 07 is selected, but when you click the dropdown you see it isn't.
Picture of submitted data:
Does anyone have any ideas how to fix this?
I'm using Microsoft Dataverse to store my data in case that is relevant.