Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Contract class-Multi Select Option (List Type)

Posted on by 2

Hi ,

   I am trying to Multi Select the Item Group , I can able to multi select too .  When I tried degugging I can able to see the List of Group ID inside the contract class(List return type parm method) untill I press the ok Button in the Dialog Form . When I press the ok button  and while clalling the parm method(List Reurn Type) from the DP class I am able to sore only the first value in the varaible .

Here is my code .

Contract class

[
    DataContractAttribute,
    SysOperationContractProcessingAttribute(classStr(ItemSummaryUIBuilder), SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly)
    ]
class ItemSummaryContract implements SysOperationValidatable
{
    List                                    itemGroupId;
    [
        DataMemberAttribute('ItemGroup'),
        SysOperationLabelAttribute(literalStr("Item Group")),
        AifCollectionTypeAttribute("Item Group", Types::String),
        SysOperationDisplayOrderAttribute("3")
            ]
        public List parmItemGroup(List _itemGroupId = itemGroupId)
    {
        itemGroupId =_itemGroupId;
        return itemGroupId;
    }
}

UI Builder class

public class ItemSummaryUIBuilder extends SrsReportDataContractUIBuilder
{
    ItemSummaryContract     contract;
    DialogField             itemGroupID;
    List                    itemGroupIDList;

 

    public void postBuild()
    {
        contract = this.dataContractObject() as ItemSummaryContract;
        itemGroupID= this.bindInfo().getDialogField(contract, methodStr(ItemSummaryContract, parmItemGroup));
        itemGroupID.registerOverrideMethod(methodStr(FormStringControl,lookup),methodStr(ItemSummaryUIBuilder,ItemGroupLookup),this);
        
    }

    public void postRun()
    {
        // this.GroupID();
    }

    private void ItemGroupLookup(FormStringControl _control)
    {
        ListEnumerator                 enum;
        Query                          query = new query();
        QueryBuildDataSource           queryBuildDataSource;
        queryBuildDataSource = query.addDataSource(tableNum(InventItemGroup));
        queryBuildDataSource.fields().dynamic(false);
        queryBuildDataSource.fields().clearFieldList();
        queryBuildDataSource.addSelectionField(fieldNum(InventItemGroup, ItemGroupId));

        SysLookupMultiSelectGrid::lookup(query,_control, _control, _control, conNull());
    }

}

DP class

[SRSReportParameterAttribute(classStr(ItemSummaryContract))]
class ItemSummaryDpClass extends SRSReportDataProviderBase
{
    ItemSummaryTemptbl itemwiseTmp;

    ListEnumerator                          itemGroupIdIterator;
    // List                                    _itemGroupId;
    List                                    _itemGroupId = new List(Types::String);

    ItemSummaryContract                 contract;

    TransDate                               fromDate;
    TransDate                               toDate;
     
    InventLocationId                        inventLocationId;
    InventSiteId                            inventSiteId;
    WMSLocationId                           locationId;
    ItemGroupId                             itemGroupId;
    ItemId                                  itemId;


    [SrsReportDataSetAttribute(tableStr(ItemSummaryTemptbl))]
    public ItemSummaryTemptbl getPurchaseOrderTmp()
    {
        select itemwiseTmp;
        return itemwiseTmp;
    }



public void processReport()
{


    InventTable                             inventTable;
    InventTrans                             inventTrans;
    InventDim                               inventDim;
    InventTransOrigin                       inventTransorigin;
    InventTransferTable                     inventTransferTable;
    InventTransferJour                      inventTransferJour;
    InventItemGroupItem                     inventItemGroupItem;
    CompanyInfo                             companyinfo;
    real                                    openingPurchQty,openingSoldQty,openingPurchvalue,openingSoldValue;


        

    contract = this.parmDataContract() as ABS_ItemSummaryContract;

    //Assigning contract values to Parameters

    fromDate          = contract.parmFromDate();
    toDate            = contract.parmToDate();
    inventLocationId  = contract.parminventLocationId();
    inventSiteId      = contract.parminventSiteId();
    //itemGroupId       = contract.parmItemGroup();
    _itemGroupId      = contract.parmItemGroup();

    locationId        = contract.parmloationId();


    select * from companyinfo
        where companyinfo.DataArea == curext();
    itemwiseTmp.CompanyName     =  companyinfo.Name;


    if (_itemGroupId != null)
    {
        itemGroupIdIterator = _itemGroupId.getEnumerator();
        while (itemGroupIdIterator.moveNext())
        {
            itemGroupId = itemGroupIdIterator.current();
            while select inventItemGroupItem where inventItemGroupItem.ItemGroupId == itemGroupId
        join inventTable where inventTable.ItemId == inventItemGroupItem.ItemId
            {
                itemwiseTmp.ItemId          =  inventTable.ItemId;
                itemwiseTmp.ItemGroupId     = inventItemGroupItem.ItemGroupId;
                itemwiseTmp.Description     =  InventTable::find(inventTable.ItemId).itemName();
                itemwiseTmp.UOM             =  InventTableModule::find(inventTable.ItemId,ModuleInventPurchSales::Invent).UnitId;
                itemwiseTmp.insert();
       
            }
        }
    }
}

I have not mentioned the controller class here .

While debugging the DP class I can able to fetch only one record inside this _itemGroupId (List  type variable)

 the following line inside the DP class ..Since I am getting only one value There is no use of iterating . I dont know where I am commiting the mistake ? Can someone please help me in this ?

_itemGroupId      = contract.parmItemGroup();

  • NoobGamer Profile Picture
    NoobGamer 2 on at
    RE: Contract class-Multi Select Option (List Type)

    Hi Komi ,

          For Normal Parameters these two properties work . But for Multi Level Parameter it doesnt allow the Nullable property . I have referred the following post but there is no solution

    community.dynamics.com/.../ssrs-the-report-parameter-dataset1_xxxx-is-a-multi-value-parameter-and-accept-null-value-this-is-not-allowed

  • Suggested answer
    Komi Siabi Profile Picture
    Komi Siabi 12,686 Most Valuable Professional on at
    RE: Contract class-Multi Select Option (List Type)

    You want the report to run even if the parameter is blank. You can set that on the report parameter property.

    Report -> Parameters -> Your parameter

    Allow blank and Nullable

    Report-parameter.JPG

  • NoobGamer Profile Picture
    NoobGamer 2 on at
    RE: Contract class-Multi Select Option (List Type)

    Thanks for replying Judy and Alex . Restoring Dataset helped me to solve this But May I know why  I am unable to allow Null values for the Multi-Select parameter . I have checked few posts regarding that . But I cannot get the answer for this.

  • Verified answer
    Alex VN Profile Picture
    Alex VN 1,994 on at
    RE: Contract class-Multi Select Option (List Type)

    Hi,

    Have you tried to restart SQLReporting service and also restore dataset for the report and check?

    Regards,

  • Verified answer
    huijij Profile Picture
    huijij 19,811 on at
    RE: Contract class-Multi Select Option (List Type)

    Hi NoobGamer,

    Did you get your solution yet?

  • NoobGamer Profile Picture
    NoobGamer 2 on at
    RE: Contract class-Multi Select Option (List Type)

    When I try to call the parm method from controller class (For Testing)!!  I can fetch the List of item Groups .

    pastedimage1660844816819v1.png

    But When I try to call it from DP class I get only the first value in that List 

    pastedimage1660849045871v2.png

  • NoobGamer Profile Picture
    NoobGamer 2 on at
    RE: Contract class-Multi Select Option (List Type)

    Is there is any issue in my code ?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,993 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans