Показать сообщение отдельно
Старый 13.01.2014, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
emeadaxsupport: Dynamics AX 2012 Enterprise Portal: range on dataSetLookup()
Источник: http://blogs.msdn.com/b/axsupport/ar...setlookup.aspx
==============

As described here Configuring the Lookup for a Data Set Field [AX 2012] you can change how lookup look like. What you can also do you can range to the lookup to show i.e. only rooms which are in service. Following X++ shows how to achieve this:

void dataSetLookup(SysDataSetLookup sysDataSetLookup)

{

List list = new List(Types::String);

Query query = new Query();

QueryBuildDataSource queryBuildDataSource;

QueryBuildRange qbr;



// Add the table to the query.

queryBuildDataSource = query.addDataSource(tableNum(FCMRooms));



// Specify the fields to use for the lookup.

list.addEnd(fieldStr(FCMRooms,RoomName));

list.addEnd(fieldStr(FCMRooms,RoomType));

list.addEnd(fieldStr(FCMRooms,InService));





// Supply the set of lookup fields.

sysDataSetLookup.parmLookupFields(list);



// Specify the field that is returned from the lookup.

sysDataSetLookup.parmSelectField('RoomName');



//add the range

qbr = queryBuildDataSource.addRange( fieldnum(FCMRooms, InService));

qbr.value(NoYes::Yes);

//if we don’t want user to be able to change range we need to lock it

qbr.status(RangeStatus::Locked);



// Pass the query to the SysDataSetLookup so that the query is used.

sysDataSetLookup.parmQuery(query);

}

We need to lock the range in order user is unable to change the range. Otherwise if user in search will specify RoomName “Cubicle 8” (when inService == No) it will still appear because the range will be simply overwritten.




Источник: http://blogs.msdn.com/b/axsupport/ar...setlookup.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.