Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  Auto populate date field depending on selection from Drop down choice field

    Gold Contributor
    Posted Mar 14, 2022 07:20 AM

    Hi,

    I need to have the date automatically filled by a certain numbers of days depending on a selection made from a Choice, drop down box.

    So if Choice A is selected the date field box will increase by 5 days from current date
    Choice B 10 days
    Choice C 15 days

    Would the date be still able to be overwritten?

    Regards

     

    Chris



    ------------------------------
    Chris Clark
    Application Support Developer / Analyst
    ------------------------------


  • 2.  RE: Auto populate date field depending on selection from Drop down choice field

    Silver Contributor
    Posted Mar 15, 2022 03:57 AM
    Normally, you could do this with a calculated column and use adddays; however, it sounds like you have a need for the column to still be editable after being updated?
    If so, it's more complicated, but quite doable.
    You can use the Power Automate adddays function to update your date - see Power Automate add days to date - SPGuides for an intro.
    Trigger the flow to run on change of your choice field.
    Put the desired date into a variable.
    To update the variable with adddays, you can either use a switch control (probably easiest) or a nested if (which you would put into the initiate variable stage).
    You will need to know the codes for you choice in the switch or you can use the below expression to get the labels
    outputs('STAGENAME')['body']['FIELDNAME@OData.Community.Display.V1.FormattedValue']

    Hope this helps.

    ------------------------------
    Donal McCarthy
    BrightWork 365 Solution Architect
    BrightWork
    Galway
    ------------------------------



  • 3.  RE: Auto populate date field depending on selection from Drop down choice field

    Gold Contributor
    Posted Mar 15, 2022 04:45 AM

    Hi Donal,

    Thank you for your reply.

    I have used this formula which seems to work

    If(IsBlank(DataCardValue46.Selected.Value), Blank(), Today()+Switch(DataCardValue46.Selected.Value, "Self-symptomatic", 10, "Household symptomatic", 14, "Contacted by Test & Trace", 14, Blank()))

    Just need to sort out how I can now send an email to a manager depending if the absence of their staff member is Covid related or not.  Ideally would like to do this from the app it's self as the manager email is not captured in a SP.

    Have a draft formula that's been suggested but not currently working as getting error for 'Return Date'. Return Date: DataCardValue54.SelectedDate Error Invalid argument typr. Expecting one of the following: Boolean, Text, number, option set value. 

    if(DataCardValue45.Value,
    "<a href = 'mailto:" && Office365Users.ManagerV2(DataCardValue7_6).mail && "?Subject=Absence & body =
    Employee Name: "&& (DataCardValue3_6.Text) &&",
    Covid Reason: "&& (DataCardValue46.Selected.Value) &&"
    Return Date: "&& (DataCardValue54.SelectedDate) && ">",

    "<a href = 'mailto: " && Office365Users.ManagerV2(DataCardValue7_6).mail && "?Subject =Absence & body =
    Employee Name: "&& (DataCardValue3_6.Text) &&",
    Absence Reason "&& (DataCardValue44.Selected.Value) && ">")

    Any assistance would be grateful



    ------------------------------
    Chris Clark
    Application Support Developer / Analyst
    ------------------------------



  • 4.  RE: Auto populate date field depending on selection from Drop down choice field

    Posted Mar 15, 2022 06:30 AM
    Hi Chris,

    I'm just wondering about the ".SelectedDate" on DataCard 54. This Operator is for use with the Date Picker Input. Is your Return Date a Label or Text Input of some sort? If so you should be able to use Text(DataCardValue54.Value)

    I may not be fully understanding your method but give it a try and let me know how it goes.

    Regards,
    Anthony.

    ------------------------------
    Anthony Scanlon
    ------------------------------



  • 5.  RE: Auto populate date field depending on selection from Drop down choice field

    Gold Contributor
    Posted Mar 15, 2022 07:59 AM

    Hi,

    I tried your solution and still had an error.  Error was field not recognised

    I tried this and no error displayed

    The only think now is I get 

    Instead of the email link to the manager??



    ------------------------------
    Chris Clark
    Application Support Developer / Analyst
    ------------------------------