What is the correct syntax of writing "where" statement in AML with C#

I need to write just write one line of AML wrapped in C# and store the ID of the item in a variable

code: 


Innovator inn = this.getInnovator();
string amlString= @"<AML><Item type='Document' action='get' where='item_number='MADL002828'' select='Document.id'/></AML>";
Item results = inn.applyAML(amlString);
return results;

Everything works except for the "where" clause in it. Just can' figure out the what kind of quotation marks does this require. 

Thanks! 

  • Hi,

    The "where" string in plain AML queries requires 3 different types of quotation marks.

    Something like this depending on your programming language.

    "<AML><Item type='Document' action='get' where='[Document].item_number=\"MADL002828\"' select='id'/></AML>"

    Tip: In Methods I would try to avoid this AML query style if possible. Sometimes you have to use it, but for simple queries a format like this is easier to write an read::

    Item updateItem = inn.newItem("Document");
    updateItem.setAction("get");
    updateItem.setAttribute("where","[Document].id =' " + myvariable + " ' ");
    updateItem.setAttribute("select","id");
    updateItem = updateItem.apply();

    In general also avoid to use the "where" statement if you don´t need it. If you know the item_number or id of something, you don´t need to use "where" at all:

    Item updateItem = inn.newItem("Document");
    updateItem.setAction("get");
    updateItem.setProperty("item_number","12345");
    OR ( updateItem.setID("123....."); )
    updateItem.setAttribute("select","id");
    updateItem = updateItem.apply();


    Best regards!
    Angela