Skip to main content

Posts

Showing posts with the label return

Validate Name in MSD Axapta

Validate Name in Axapta To Validate Name in Axapta  you can refer below code. --------------------------------------Code block---------------------------- boolean validatestrName(str strName) { Boolean valid,flag; System.Boolean flagTest; str matchstrNo = "^[a-z, ,A-Z]+$"; System.Text.RegularExpressions.Match myMatch; New InterOpPermission(InteropKind::ClrInterop).assert(); myMatch =System.Text.RegularExpressions.Regex::Match(strName,matchstrNo); flagTest = myMatch.get_Success(); flag = flagTest; CodeAccesspermission::revertAssert(); if(strName == "") return true; else return flag; } --------------------------------------End Code block-------------------------

Use of query elements in report using axapta

public boolean fetch() { QueryRun qr; QueryBuildRange rangeTransDate; Boolean ret; qr = new QueryRun(element); rangeTransDate = element.query().dataSourceTable(tablenum(CustTrans)).addRange(fieldnum(CustTrans, transDate)); rangeTransDate.value(queryRange(systemdateGet()-daysBack, systemDateGet())); rangeTransDate.status(RangeStatus::LOCKED); element.design().caption(strfmt("%1, %2", element.design().caption(), rangeTransDate.value())); if (qr.prompt() && element.prompt()) { while (qr.next()) { custTable = qr.get(tableNum(CustTable)); custTrans = qr.get(tableNum(CustTrans)); if (!custTable) { ret = false; break; } if (qr.changed(tableNum(custTable))) { element.send(custTable, 1); } if (qr.changed(tableNum(custTrans))) { element.send(custTrans, 2); } } ret = true; } else ret = false; return ret; }