web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Expression for getting...
Power Automate
Unanswered

Expression for getting dynamic content from one of two date questions?

(0) ShareShare
ReportReport
Posted on by 23

Hi there.

 

My form has two questions that ask for a date. Users will only ever answer one of the two questions. I want an expression that fetches the date entered on whichever question they answered. I have written some expressions, but I continue to get the same error:

 

Error details: Input parameter 'item/example question' is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'.

 

Here are two expressions that I've tried:

 

if(empty([dynamic content for question 1]), [dynamic content for question 2], [dynamic content for question 1])

 

if(contains([dynamic content for question 1], '2'), [dynamic content for question 1], [dynamic content for question 2])

 

I understand that the second expression is messy, but I was just seeing if I could find a workaround since the first expression didn't work.

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at

    Hi can you please verify the following

     

    both controls are text boxes or date selectors? 

    Can you validate the name of each

    Lastly where does this valued go? S

     

    Just want to write the expression correctly 
    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at

    Hi @Michael291 

     

    see whether this expression may helps you ?

     

    if(equals([dynamic content for question 1],'"")', [dynamic content for question 2], [dynamic content for question 1])

     

    Let me know 

     

     

  • Michael291 Profile Picture
    23 on at

    Hi Nived,

     

    No, it doesn't work. I continue to receive the same error when using that expression.

  • Michael291 Profile Picture
    23 on at

    Hi Michael,

     

    Thank you for being willing to assist me.

     

    Both questions are date selectors. Both questions are required; depending on how the branching leads the user through the form, one (and only ever one) of the two questions must be answered.

     

    I'm not quite sure what you mean by "validate the names." I thought "[question 1]" and "[question 2]" would be sufficient. I can always replace "[question 1]" and "[question 2]" with the questions' unique identifiers when I add the expression to my flow.

     

    This flow captures data from form submissions and places it in a SharePoint list.

  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at

    Hi,

     

    I just wanted to make sure I knew for sure the names, so whatever expression I wrote worked, no worries.

     

    1. Are you asking how to do this check IN Power Automate or the UI?

    2. Are these "strings" (from the UI) or Choice values? Drop downs?

    3. Please provide pictures of the Actions you are using and what you typed in the Expression


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

  • Michael291 Profile Picture
    23 on at

    1. I'm asking how to do this in Power Automate. I want my SharePoint list to display the date entered on whichever of the two date-selector questions was answered.

    2. The questions both look like this:

    Screenshot 2023-09-27 at 9.31.01 AM.png

    3. Below are the actions I'm using. The two unsuccessful expressions I've tried are in my original post. I also tried the expression that Nived provided.

    Screenshot 2023-09-27 at 9.33.39 AM.png

  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at

    Hi

     

    Ah that adds so much more light to the situation, we both thought you were simply doing an expression, maybe in a Compose so our answers do not work for a Condition

     

    And based on the Ask, using the condition doesn't make sense let me explain.

     

    Originally it sounded like you wanted to "get back" the valid date based on a check like this

    CurrentAnswer = If (first is blank, return second, return first).

     

    To me, this meant you would place the Expression IN the Create Item (That I can now see), in the Column that needs the answer.

     

    But now you are using the Condition as a way to check IF you should even create a Record, which seems wrong, but maybe you actually need both.

     

    Question:

    1. Do you have a single field for this to be written in or do you have two fields and you only want one populated in your Create Item

     

    2. Do you also want to validate that at least one has an answer BEFORE you even attempt to save it.

     

    2 different use cases for the data and each one needs a different answer.

     

    hehe 🙂 I hope that makes sense.

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Michael291 Profile Picture
    23 on at

    The expression is going in the Create Item action.

     

    The use of the Condition action is necessary. Based on answers to particular questions, there are form submissions that should not be tracked in the corresponding SharePoint list. I created the condition so that only form submissions adhering to the list's purpose result in items being created.

     

    1. There is a single field on my SharePoint list. I need the corresponding column to display the date entered on question 1 or question 2.

    2. No, there is no need to validate that at least one of the questions has been answered. Given how I've branched my form, it's not possible for users to avoid answering both of these questions. (They'll always avoid one but never both.)

  • Michael E. Gernaey Profile Picture
    53,335 Super User 2025 Season 2 on at

    Hi,

     

    Thanks for that.

     

    My expectation is that these come from the Action Get Details and or From the Body or the Trigger itself

    Which means to access their values you would need to use the Dynamic Properties of Get Details or the Trigger and replace the outsputs(I have as an example) with the Trigger/Get Details dynamic properties.

     

    // this checks if the column 1 is blank and if so it returns column 1. But we need to fill in the proper syntax of the 

     

    Coalesce(outputs('Get_Details')?['Column Name 1'], outputs('Get_Details')?['Column Name 2'], outputs('Get_Details')['Column Name']);

     

    or

     

    or something like //
    if(equals([dynamic content for question 1],'"")', [dynamic content for question 2], [dynamic content for question 1])

     

    Which is what @Nived_Nambiar  was saying and you needed to replace the dynamic content text he has with the Dynamic Property

     

    What's important is to see they are dynamic properties and put them in the expression or if they are not in which case we need to leverage the proper Path Syntax to access their values.

     

    1. Can you please share the output dynamic properties of Get Details

     


    Cheers
    If you like my answer, please Mark it as Resolved, and give it a thumbs up, so it can help others
    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Michael291 Profile Picture
    23 on at

    Michael,

     

    I might be missing something, but I'm not sure why you refer to them as "columns." They are questions on a Microsoft Form. I am trying to get the answer to whichever form question was answered to populate in a particular column on a SharePoint list.

     

    When I use your expression and Nived's expression (substituting in the dynamic content for the corresponding questions), I get the following error:

    The runtime value '""' to be converted doesn't have the expected format 'String/date'.

     

    Below are the two expressions I tried:

    coalesce(outputs('Get_response_details')?['body/rea2282af55f34959854ceec89f061f21'],outputs('Get_response_details')?['body/r963229b6e952403cbfeee53c676a0b02'],outputs('Get_response_details')?['body/rea2282af55f34959854ceec89f061f21'])

     

    if(equals(outputs('Get_response_details')?['body/rea2282af55f34959854ceec89f061f21'], '""'),outputs('Get_response_details')?['body/r963229b6e952403cbfeee53c676a0b02'],outputs('Get_response_details')?['body/rea2282af55f34959854ceec89f061f21'])

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

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard