Digital Assistant and Mobile

Get Involved. Join the Conversation.

Topic

    Dharshan B
    How to use Duration In Complex Entity PropertiesAnswered
    Topic posted October 14, 2019 by Dharshan B, tagged Bots, Facebook 
    25 Views, 5 Comments
    Title:
    How to use Duration In Complex Entity Properties
    Summary:
    How to use Duration In Complex Entity Properties

    Best Comment

    Frank Nimphius

    Hi,

    just create a variable for type DURATION and assign it as a "variable" property reference in the System.Text component. If the user then types a message like "I want to take the next 3 days off" then the variable will have its startDate and endDate attributes set. They can also say "I want to take days off from Nov 13 2019 to Nov 23 2019" Users can basically type whatever they want for as long as a duration is contained. So "from Nov 13 2019 to Nov 23 2019" should also work

    Frank

    Comment

     

    • Frank Nimphius

      Hi,

      "Duration" IS an entity with complex properties. If you have a variable (lets say "myDuration") of type DURATION, then

      variables:
        myDuration: "DURATION"

      states:
         print:
           component: "System.Output"
           properties:
             text: "From ${myDuration.value.startDate} to ${myDuration.value.endDate}"

      If you associate "DURATION" with an intent then DURATION will be detected in user messages. If you reference the "myDuration" variable from the "variable" property of an input component, then the DURATION tool will be extracted from the user input. Those entities are called entities with complex properties because they return more than a single value

       

      Frank

      • Dharshan B

        Hi Frank

        I Want to get start date and End date from User via System.Text  with date validation

        Could you provide me  a sample flow

        Thanks in adv

    • Frank Nimphius

      Hi,

      just create a variable for type DURATION and assign it as a "variable" property reference in the System.Text component. If the user then types a message like "I want to take the next 3 days off" then the variable will have its startDate and endDate attributes set. They can also say "I want to take days off from Nov 13 2019 to Nov 23 2019" Users can basically type whatever they want for as long as a duration is contained. So "from Nov 13 2019 to Nov 23 2019" should also work

      Frank

      • Dharshan B

        thanks frank

         

      • Dharshan B

        Hi Frank,

        I have done that Start date and End date input using Date Entity.In that I want to do validation

        like If i give start date input is Tomorrow and End date input is Today means its need to show some error or dose not consider that input

        any sample is there?