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:

Enrico said...

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

Alex P. said...

The right solution is:

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

wojzeh said...

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