Hi
Some help for a DAX newbie please!
I have a lookup method on a field that displays a field from the database, code as follows:
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr1;
QueryBuildRange qbr2;
QueryBuildRange qbr3;
SysTableLookup sysTableLookup;
qbds = query.addDataSource( tableNum(DocuRef));
qbr1 = qbds.addRange( fieldNum(DocuRef,TypeId));
qbr2 = qbds.addRange( fieldNum(DocuRef,RefTableId));
qbr1.value('SALESDOC');
qbr2.value('359');
qbds = qbds.addDataSource( tableNum(SalesLine));
qbds.joinMode(JoinMode::InnerJoin);
qbds.relations(true);
qbds = qbds.addDataSource( tableNum(ProdTable));
qbds.joinMode(JoinMode::InnerJoin);
qbds.relations(true);
qbr3 = qbds.addRange( fieldNum(ProdTable,ProdId));
qbr3.value(queryValue(_prodId));
// qbr1 = q.addDataSource(tableNum(DocuRef));
//qbr1.addRange(fieldNum(ProdTable, ProdId)).value();
sysTableLookup = SysTableLookup::newParameters(tableNum(DocuRef), _formControl);
sysTableLookup.addLookupfield(fieldNum(DocuRef, Notes), true);
sysTableLookup.addLookupfield(fieldNum(DocuRef, TypeId), false);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
This works fine, except for the fact the field "Notes" in the DocuRef table in my system is a carriage return delimited list (so only one selection is returned from the dropdown).
I have been able to split the field "Notes" in a Job as follows:
queryRun = new QueryRun(query);
// Retrieves the next record from the query.
while(queryRun.next())
{
// Get Result
docuref = queryRun.get( tableNum(DocuRef));
notes = docuref.Notes;
_list = Global::strSplit(notes,'\n');
iterator = new ListIterator(_list);
while (iterator.more())
{
packList += iterator.value();
iterator.next();
}
for (i = 1; i <= conlen(packList); i++)
{
info(conPeek(packList,i));
}
}
My question is, how can I combine my two pieces of a code?
For example, if the Notes field contains:
tag1
tag2
tag3
How can I get three seprate entries in the dropdown? At the moment I get:
tag1tag2tag3
Many thanks in advance