web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

MultiSelect lookup in a SSRS report with BaseEnum?

(0) ShareShare
ReportReport
Posted on by 735

Hi All,

There are plenty sources where “How to create a MultiSelect lookup in a SSRS report” can be found.

I have followed them and finally I have a lookup with multiselect parameter.

The problem is that in the Dialog Field it shows BaseEnum values (1,2,4)instead of Labels of the BaseUnum that I have chosen (Crane, Equipment, Marine), while when it prompts to choose the parameter it shows BaseEnum Labels .

6153.2.jpg


I have created a query for this lookup, that retrieves data from the reference table with my BaseEnum.

Is there are any way to show the labels of the BaseEnum? More over, I will pass these values to the Visual Studio and have to reflect them to (I mean BaseEnum Labels, now it shows BaseEnum Values (like 1,2,3 instead of Crane, Equipment, Marine)).

I have tried to override the getFromDialog() in my UIBuilder class

public void getFromDialog()

{

   Category     category;

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

   Contract    contract     = this.dataContractObject();

   ListIterator listIterator = new ListIterator(contract.parmCategoryList());

  

  

  

   while(listIterator.more())

   {

       category = listIterator.value();

       list.addEnd(enum2str(category));

       listIterator.next();

   }

  

   contract.parmCategoryList(list);

   super();

}

Not succeed. I have commented the //super(); in the method above or place it before the while(listIteraror…). Doesn’t helped.

Any Ideas? Thank you beforehand.

Oleksandr

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    48,938 User Group Leader on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    Have you tried index2Label ???

    see any example here

    static void JobIndexToLabel(Args _args)
    {
        DictEnum enum = new DictEnum(enumName2Id(literalStr(Category)));
        int i;
        for (i=0; i < enum.values(); i++)
        {
            info(enum.index2Label(i)); //in this line replace i with your number of base enum
        }   
    }

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    Hi Sohaib, thank you for quick reply, sorry for this silly question, but in which method I have to place this code?

    Thank you

    Oleksandr

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    I have to add, by several testing I make a conclusion, that any manipulation in getFromDialog() method - is too late. It's should be placed some where earlier (but I don't know in which method)

  • Sohaib Cheema Profile Picture
    48,938 User Group Leader on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    can you please show us code of Dialog method and your lookup

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    class ReportUIBuilder extends SrsReportDataContractUIBuilder

    {

       DialogField                  dialogFieldCategory,

                                    dialogFieldMonthQuarter,

                                    dialogFieldFromDate,

                                    dialogFieldToDate,

                                    dialogFieldReportDate;

       PCLESInsuranceReportContract insuranceReportContract;

    }

    //-----------------------------------------------------------

    public void postRun()

    {

       Dialog dialogLocal      = this.dialog();

       ReportContract contract = this.dataContractObject();

       //super();

       dialogLocal.dialogForm().formRun().controlMethodOverload(false);

       dialogFieldCategory     = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmCategoryList));

       dialogFieldMonthQuarter = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmMonthQuarter));

       dialogFieldReportDate   = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmReportDate));

       dialogFieldFromDate     = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmFromDate));

       dialogFieldToDate       = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(ReportContract, parmToDate));

       dialogFieldReportDate.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(ReportUIBuilder, reportDateModified), this);

       dialogFieldMonthQuarter.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(ReportUIBuilder, reportDateModified), this);

       dialogFieldCategory.registerOverrideMethod(methodstr(FormStringControl, lookup), methodstr(ReportUIBuilder, categoryLookup), this);

       dialogFieldFromDate.allowEdit(false);

       dialogFieldToDate.allowEdit(false);

    }

    // -------------------------------------------------------------------

    public void categoryLookup(FormStringControl    _control)

    {

       Query query = new Query(queryStr(ReportCategoryQuery));

       container   cnt;

       ;

       SysLookupMultiSelectGrid::lookup(query, _control, _control, cnt);

    }

  • Suggested answer
    sivakarthk Profile Picture
    10 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    Hi,

    I am getting same issue while selectting enum values .

    Could you please help me.

    Thanks in advance.

  • Ragoza Oleksandr Profile Picture
    735 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    As far as I remember, I’ve made one more column in table where the BE Name’s are stored, so that (new) column is string type, so I showed in dialog exactly the string values

  • Suggested answer
    Kanagaraj A Profile Picture
    1,254 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    It's possible with little workaround.

    1. Create one temp table and create fields(for ex: Base Enum : PurchStatus) enum always string value .

    2. Then dynamically insert the baseEnum values into your table.

    3. Create query with this temp table.

    4. then add this query and dynamically insert coding into your SSRS Report multiselect query.

          When click Lookup from your report menu item, then the UIBuilder class call the Lookup method of parameter.If you done your coding in that method, it will automatically insert the records to table and display value into Lookup.

         In future if anyone added extra baseenum means we don't worry about the report.

    Hope it solve your problem

    Try it and update the status......

  • _MGP Profile Picture
    506 on at
    RE: AX 2012 MultiSelect lookup in a SSRS report with BaseEnum?

    Does anyone have any working coded examples that achieve a solution?

    I am using a class extending SysOperationAutomaticUIBuilder and have several multi-select lookups working fine.

    However, all of the code examples I've found to date to support a multi-select list of Enums are for using Forms and not SSRS parameter dialogs. Adapting them has not worked.

    e.g. http://robscode.onl/x-syslookupmultiselectctrl-with-temporary-table/

    I'll post a code example solution here if I find one or get it working myself.

  • Suggested answer
    _MGP Profile Picture
    506 on at
    RE: MultiSelect lookup in a SSRS report with BaseEnum?

    I used my tried and trusted technique for creating a multi-select as below but it only worked when I made the table's TableType = "Regular" instead of my preference for "TempDB" or "InMemory".

    I end up deleting any data in the table before inserting the enum values in each time the lookup is done.

    I think this is a very unsatisfactory solution and would hope there is a better alternative to having to populate a real SQL table on the fly.

    class MP_SSRS_086_UIBuilder extends SysOperationAutomaticUIBuilder
    {
        MP_SSRS_086_SrsReportContract   contract;
    
        DialogField                         multiTaskStatus;
    }
    
    public void build()
    {
        //super();
    
        contract = this.dataContractObject() as MP_SSRS_086_SrsReportContract;
    
        multiTaskStatus = this.addDialogField(
            methodStr(MP_SSRS_086_SrsReportContract, parmMultiActivityTaskTimeType),
            contract);
    
    }
    
    public void multiTaskStatusLookup(FormStringControl _control)
    {
        Query                           query;
        
        QueryBuildDataSource            qbds;
        
        MP_SSRS_086_TmpEnumValues   	tmpEnumValues;
    
        TableId                         multiSelectTableNum = tableNum(MP_SSRS_086_TmpEnumValues);
        
        container                       selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(MP_SSRS_086_TmpEnumValues, ValueLabel))];
    
        tmpEnumValues.setTmpData(this.fillEnumTable());
        
        query = new Query();
        
        qbds = query.addDataSource(tableNum(MP_SSRS_086_TmpEnumValues));
        qbds.addSelectionField(fieldNum(MP_SSRS_086_TmpEnumValues, ValueLabel));
    
        SysLookupMultiSelectGrid::lookup(query, _control, _control, selectedFields);
    }
    
    private MP_SSRS_086_TmpEnumValues fillEnumTable()
    {
        MP_SSRS_086_TmpEnumValues   enumTmp;
        SysDictEnum                 dictEnum = new SysDictEnum(enumNum(SmmActivityTaskTimeType));
        int                         idx;
    
        delete_from enumTmp;
    
        for(idx = 0; idx < dictEnum.values(); idx++)
        {
            enumTmp.clear();
            enumTmp.initValue();
            enumTmp.ValueId = dictEnum.index2Value(idx);
            enumTmp.ValueLabel = dictEnum.index2Label(idx);
            enumTmp.insert();
        }
    
        return enumTmp;
    }

    class MP_SSRS_086_UIBuilder extends SysOperationAutomaticUIBuilder
    {
    MP_SSRS_086_SrsReportContract contract; DialogField multiTaskStatus;
    }
    public void build()
    {
    //super(); contract = this.dataContractObject() as MP_SSRS_086_SrsReportContract; multiTaskStatus = this.addDialogField(
    methodStr(MP_SSRS_086_SrsReportContract, parmMultiActivityTaskTimeType),
    contract); }
    public void multiTaskStatusLookup(FormStringControl _control)
    {
    Query query;
    QueryBuildDataSource qbds;
    MP_SSRS_086_TmpEnumValues tmpEnumValues; TableId multiSelectTableNum = tableNum(MP_SSRS_086_TmpEnumValues); container selectedFields = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(MP_SSRS_086_TmpEnumValues, ValueLabel))];
    tmpEnumValues.setTmpData(this.fillEnumTable());
    query = new Query(); qbds = query.addDataSource(tableNum(MP_SSRS_086_TmpEnumValues)); qbds.addSelectionField(fieldNum(MP_SSRS_086_TmpEnumValues, ValueLabel)); SysLookupMultiSelectGrid::lookup(query, _control, _control, selectedFields);
    }
    
    


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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans