Oct 24, 2013

How to get the address in single line


//BP Deviation documented
display Addressing CompanyAddress()
{
    str     singleLineAddr;
    ;

    for (j=0; j<10 j="j" p="p">    {
        if (j == 0 && strLine(CompanyInfo::find().Address, j))
        {
            singleLineAddr  +=  strLine(CompanyInfo::find().Address, j);
        }
        else if (strLine(CompanyInfo::find().Address, j))
        {
            singleLineAddr  +=  ', ' + strLine(CompanyInfo::find().Address, j);
        }
        else
        {
            break;
        }
    }

    return singleLineAddr;

}

Finding primary key in a table

The following job gives the name the primary field

DictTable dictTable;
DictField dictField;
;
dictTable = new SysDictTable(tableNum(TaxTrans));
dictField = new SysDictField(dictTable.id(), dictTable.primaryKeyField());
 info(dictField.name());