Thursday, August 12, 2010

Value in Query range

How to use Enum values in Query ranges:



public void init()
{
    QueryBuildRange   criteriaOpen;
    ;
    super();
    criteriaOpen = this.query().dataSourceTable(tableNum(ProdTable)).addRange(fieldnum(ProdTable, ProdStatus));
    criteriaOpen.value("Started"); // it does not work in non-English interface!!!

    criteriaOpen.value(enum2str(ProdStatus::StartedUp)); // not enough good...

        criteriaOpen.value(QueryValue(ProdStatus::StartedUp); // now it is correct!    
}

3 comments:

  1. Hi Alexey,

    just use this syntax to pass values to query ranges (doesn't matter which data datatype):

    criteriaOpen.value(SysQuery::value(ProdStatus::StartedUp));

    The rest is being done in the SysQuery class.

    Cheers,
    Enrico

    ReplyDelete
  2. The right solution is:

    criteriaOpen.value(QueryValue(ProdStatus::StartedUp);

    ReplyDelete
  3. Thank you guys for your hints! I corrected the original post.

    ReplyDelete