Forum Discussion

anhht-hue's avatar
anhht-hue
Ideator I
7 years ago

Search Parameter with date time

I have condition parameter search for ItemType Part like this (modified_on > 2019-04-11T00:00:00 and  modified_on <= 2019-04-20T00:00:00)

Case 1. When I new item AML  to search

<Item type="Part" action="get" select="*" where="[Part].modified_on &gt; '2019-04-11T00:00:00'  AND [Part].modified_on &lt;='2019-04-20T00:00:00' >".

----> it will return list Part with Part modified on 2019:04:05T00:00:00 -> Wrong, I dont know why the result is wrong

Case 2. So I change code to create new AML 

<Item type="Part" action="get" select="*">

 <modified_on condition="gt">2019-04-11T00:00:00 </modified_on>

 <modified_on condition="le">2019-04-20T00:00:00</modified_on>

</Item>

----> It will return true results. So please help to find error in this case 1. Thanks so much

3 Replies

  • Hi Anhht

    I guess the error is because of the = in your first query (after &lt;)

    <AML>
    <Item type = "Part" action = "get" where="[Part].modified_on &gt; '2019-04-11T00:00:00' AND [Part].modified_on &lt;'2019-04-20T00:00:00'"></Item>
    </AML>

    Alternately, you can use below query also to get the expected results

    <AML>
    <Item type="Part" action="get">
    <modified_on condition="between">2019-04-11T00:00:00 and 2019-04-20T00:00:00</modified_on>
    </Item>
    </AML>

    Another Way

    <AML>
    <Item type="Part" action="get">
    <modified_on condition="gt">2019-04-11T00:00:00</modified_on>
    <modified_on condition="lt">2019-04-20T00:00:00</modified_on>
    </Item>
    </AML>

    Thanks,

    GK

    • anhht-hue's avatar
      anhht-hue
      Ideator I

      Thanks so much @gkarasuser,

      Can I ask you another question? Is that AML not support operator <= or "le" ?

      By the way, I will try follow your answer. Thanks buddy.

      • Gopikrishnan's avatar
        Gopikrishnan
        Ideator I

        Hi Anhht

        If you want to use "le" or "ge" it should be like

        <AML>
        <Item type = "Part" action = "get">
        <modified_on condition="ge">2019-04-11T00:00:00</modified_on>
        <modified_on condition = "le">2019-04-20T00:00:00</modified_on
        </Item>
        </AML>

        It is not working when we are giving it as attribute. 

        Thank You

        GK