How to get New Worker Id through code in ax 2012

How to get New Worker Id through code in ax 2012

Description: Here I have given simple demonstration to get new worker number sequence code or Worker personnel Number through code in ax 2012.

Code

static void getNewEmployeeId(Args _args)
{
    HcmPersonnelNumberId    hcmPersonnelNumberId;
    NumberSequenceReference numberSeqReferencePersonnelNum;
    NumberSequenceTable     numberSeqTablePersonnelNum;
    NumberSeq               numberSeqPersonnelNum;

    // Number Sequence
    numberSeqReferencePersonnelNum  = NumberSeqReference::findReference(extendedTypeNum(HcmPersonnelNumberId));
    numberSeqTablePersonnelNum      = NumberSequenceTable::find(numberSeqReferencePersonnelNum.NumberSequenceId);
    if (numberSeqTablePersonnelNum)
    {
        // generate worker personnel number if number sequence code is created.
        numberSeqPersonnelNum = NumberSeq::newGetNumFromId(numberSeqTablePersonnelNum.RecId, true, true);
        if(numberSeqPersonnelNum)
        {
            hcmPersonnelNumberId = numberSeqPersonnelNum.num();
            info(strFmt("%1",hcmPersonnelNumberId));
        }
    }
    //return hcmPersonnelNumberId;
}
Pass Array one form to another form in ax 2012

Pass Array one form to another form in ax 2012

Description: Here I have given simple demonstration to pass array one form to another in ax 2012. You can pass String, Container, Class, BLOB, Date, Enum, Integer, Int64 etc...

Here I have given string array example to pass array Object in one form to another form in ax 2012. On your button click event create initialize array object and store you want to store string value.

Form-1 Button click event.

Args    args = new Args();
Array   items = new Array( Types::String );
super();

items.value(1,strFmt("%1",Custtable.AccountNum));
args.parmObject(items);
args.name(formstr(FormName));
args.caller(this);
formRun = classfactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
formRun.detach();

Form-2 Form init method.

Array   items;
Str 20 _CustAcc;
super();
if(element.args().dataset())
{
   if(element.args().parm())
   {
      items = element.args().parmObject();
      _CustAcc = items.value(1);
   }
}
How to post inventory journal using code in ax 2012

How to post inventory journal using code in ax 2012

Description: Below is X++ code which is good to keep handy. It can be used to create and post inventory movement journals in AX 2012 R2. I have use hard coded values for illustration purpose.
here i have written a quick code to to post the invent transfer journal.

Public InventJournalTable populateInventJournalTable()
{
    InventJournalTable      journalTable;
    InventJournalTableData  journalTableData;

    journalTable.clear();

    journalTable.JournalNameId  = InventParameters::find().QuickTransferJournalNameId;
    journalTableData            = JournalTableData::newTable(journalTable);
    journalTable.JournalId      = journalTableData.nextJournalId();
    journalTable.Reservation    = ItemReservation::Automatic;
    journalTable.JournalType    = InventJournalType::Transfer;         
    journalTableData.initFromJournalName(journalTableData.JournalStatic().findJournalName(journalTable.journalNameId));
    journalTable.Description    = InventDescription.valueStr();
    journalTable.insert();
    return journalTable;
}

public InventJournalTrans populateInventJournalTrans(InventJournalId _InventJournalId)
{
    InventJournalTrans inventJournalTrans;
    InventDim          toInventDim;

    inventJournalTrans.JournalId      = _InventJournalId;

    inventJournalTrans.JournalType    = InventJournalType::Transfer;
    inventJournalTrans.TransDate      = systemdateget();
    inventJournalTrans.ItemId         = inventSum.ItemId;
    inventJournalTrans.Qty            = InventQty.realValue();

    // Dimensions from which the transfer performs
    inventJournalTrans.InventDimId    = inventDimLocal.inventDimId;
    inventJournalTrans.initFromInventTable(InventTable::find(inventSum.ItemId), False, False);

    // Dimensions To which the transfer performs
    toInventDim.inventSiteId         = InventSite.valueStr();
    toInventDim.InventLocationId     = InventWareHouse.valueStr();
    inventJournalTrans.ToInventDimId = InventDim::findOrCreate(toInventDim).inventDimId;
    inventJournalTrans.insert();
    return inventJournalTrans;
}

public void createAndPostJournal()
{
    InventJournalTable      inventJournalTable;
    InventJournalTrans      inventjournalTrans;
    JournalCheckPost        journalCheckPost;
    ttsbegin;
    // populates the inventJournalTable table
    inventJournalTable = element.populateInventJournalTable();
   // populates the inventJournalTrans table
    inventjournalTrans = element.populateInventJournalTrans(inventJournalTable.JournalId);
    ttsCommit;
    if (BOX::yesNo('Do you want to post the Journal ? ', DialogButton::Yes) == DialogButton::Yes)
    {
        // Call the static method to create the journal check post class
        journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
        if(journalCheckPost.validate())
        {
            try
            {
                journalCheckPost.run();
            }
            catch
            {
                // Deletes the InventJournalTable table, the InventJournalTrans will auto delete because of the Delete actions.
                InventJournalTable.delete();
            }
        }
     }
}
how to get HcmWorker name and id in ax 2012

how to get HcmWorker name and id in ax 2012

Description: Here I have given simple demonstration to get worker id, name etc... If you have worker personnel Number, Name, id etc. then you can find another information.

Code:-

info(strFmt("%1",DirPerson::find(HcmWorker::findByPersonnelNumber("000123").Person).Name));   
info(strFmt("%1",HcmWorker::findByPersonnelNumber("000123").RecId));
info(strFmt("%1",curUserId()));
select * from UserInfo where UserInfo.id == curUserId();
if(UserInfo.id != '')
{        info(strFmt("%1",HcmWorker::findByPerson(DirPerson::find(DirPartyTable::findByName(UserInfo.name).RecId).RecId).PersonnelNumber));
}
Field WorkerName is not compatible with field WorkerName

Field WorkerName is not compatible with field WorkerName

Description:- This post provides insight about a synchronize error received during full AOT for AOT view 'ProjUnpostedTransView' and its resolution.

ProjUnpostedTransView: Synchronize database there is a field mismatch in the union query. Field WorkerName is not compatible with field WorkerName.

As per mentioned in the synchronize database error (1), all the errors have come in the View, 'ProjUnpostedTransView'. Exploring the same yields the composition of the view on following sub views.

ProjLedgerJournalTransUnpostedView
TrvExpTransDistributionsUnposted
ProjJournalTransFeeUnpostedView
projCustInvoiceLineDistsUnpostedView
ProjJournalTransHourUnpostedView
ProjProdJournalRouteUnpostedView
InventJournalTransUnpostedView
ProjProdJournalBOMUnpostedView
VendInvoiceInfoLineDistributionsUnposted
ProjOnAccTransUnpostedView
ProjIntercompanyUnpostedExpView
TSUnpostedTimesheetLinesAllView
ProjIntercompanyUnpostedTSView
ProjIntercompanyUnpostedVendInvLineView

Each of these views comprise of one or more tables. And each of these views as a data source has the HCMWorker data source with in further relating to DirPartyTable to fetch the worker name. Closely monitoring each of them reveals that the following four data sources were returning null for the worker name. Obviously the logic implemented would have required the field (since a union query) to have a consistent schema returned. Further to returning null, the fields were provided the extended type, "Name" which was different from what is returned from DirPartyTable Name field which extends "DirPartyName" extended type.  

Data sources with inconsistent extended types

projCustInvoiceLineDistsUnpostedView
ProjProdJournalBOMUnpostedView
ProjInventJournalTransUnpostedView
ProjOnAccTransUnpostedView

Due to this EDT mismatch, the AOT framework was giving errors.

Providing the correct extended type of DirPartyName to the WorkerName fields for each of these views made the schema fully consistent, hence error removed.

How to use sorting in the select statements in Dynamics Ax

By default, a while select statement that returns multiple rows will sort the result ascending by the primary index on the table. You can see this in the first two examples in the previous section.
If you would like to have a statement return the rows in a different order, you have to use the order by parameter in the select statement and specify which fields you would like to sort the result by. If you have an index that corresponds with the sorting, you can use the name of the index to order by as well, but then you will have to use the index statement instead of order by. The following example will return all the records in the CarTablesorted in a descending order of mileage:

static void selectRecordsSortedDesc(Args _args)
{
    A_PurchaseOrder objA_PurchaseOrder;
    int records;
    info("------------------START-------------------");
    while select objA_PurchaseOrder
    order by Purchase_ID desc
    {
       info("--------------NEW RECORD--------------");
       info (strfmt("Purchase_ID: %1", objA_PurchaseOrder.Purchase_ID));
       info (strfmt("Vender_Code: %1", objA_PurchaseOrder.Vender_Code));
       info (strfmt("Purchase_Date: %1", objA_PurchaseOrder.Purchase_Date));
       info (strfmt("Status: %1", objA_PurchaseOrder.Status));
       info (strfmt("Purchase_Amount: %1", objA_PurchaseOrder.Purchase_Amount));
       records++;
    }
    info("------------------END-------------------");
    info(strfmt("%1 records was selected", records));
}


How to Enable or Disable DataSource Fields through code in ax 2012

How to Enable or Disable DataSource Fields through code in ax 2012

Description: -

Here we will enable/disable DataSource fields control through code in Ax 2012. Here I have given simple demonstration for enable/disable DataSource fields in form.

Example:-

My DataSource contain Field like “Display” its Enum fields NoYes. In form I have check if there ii get yes then I want to enable this field in form otherwise I don’t want to enable. So I have use below code to enable/disable fields in form. Also you can access more property of that fields.

Code:-

DataSourcename_ds.object(fieldnum(TableName, FieldName)).allowEdit(false);
DataSourcename_ds.object(fieldnum(TableName, FieldName)).visible(false);
Populate Database Column in a Dropdownlist in asp.net

Populate Database Column in a Dropdownlist in asp.net

Description:-

In this article we will populate table column inside Dropdownlist control using database connection. here you can see i have created a database connection and get data from database using command inside page_load event. here is the demo example to bind column inside dropdownlist control.

Create Table:-
CREATE TABLE [dbo].[Employee](
                [Emp_Id] [bigint] IDENTITY(1,1) NOT NULL,
                [Emp_Name] [varchar](50) NOT NULL,
                [Emp_Photo] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_Employee_1] PRIMARY KEY CLUSTERED
(
                [Emp_Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
 
GO

Web.Config:-
<connectionStrings>
    <add connectionString="ConnectionString" name="DBCS" providerName="System.Data.SqlClient"/>   
</connectionStrings>

Default.aspx:-
<div>
  <asp:Label ID="lbluser" runat="server" Text="User Name"></asp:Label>
  <asp:DropDownList ID="drpusername" runat="server"></asp:DropDownList>
</div>

Default.aspx.cs:-
string Str = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
  SqlConnection con = new SqlConnection(Str);
  SqlCommand cmd = new SqlCommand("Select Emp_Name from Employee", con);
  cmd.CommandType = CommandType.Text;
  SqlDataAdapter da = new SqlDataAdapter();
  da.SelectCommand = cmd;
  DataTable dt = new DataTable();
  da.Fill(dt);
  drpusername.DataSource = dt;
  drpusername.DataTextField = "Emp_Name";
  drpusername.DataValueField = "Emp_Name";
  drpusername.DataBind();
}

Field Mismatch in Union Query in Dynamics Ax 2012 R3 || ProjUnpostedTransView-Field WorkerName is not compatible with field WorkerName

Field Mismatch in Union Query in Dynamics Ax 2012 R3 || ProjUnpostedTransView-Field WorkerName is not compatible with field WorkerName

Description:- Yesterday, after code merger or migrate from Dynamics Ax 2012 R2 to R3, I got very strange errors in AOT Query or static Query.

“Field Mismatch in Union Query”.

In code migration, they increased the field length of EDT. For example for Unknown reason In one of customs code, they increase the “Name” EDT from 60 to 120 character. And this result into creating problems in Union Based Queries.

I solved it following way.

Expand the Union Query.
Select all views one by one. And check that field on which exception through.
Expand the query on which view,
Locate the table, and from field I get the EDT name
Change the length of EDT and let it synchronize.
Expand the table and check the field Length.
Expand the View it shows the old length.
Expand the query, Right click on it and restored. If length did not reflect change and no customization in View.
Right click and delete it. View will delete and restored again from Sys layer. New view will shows the update length.
Compile the query.

How to get advance license in sales order in ax 2012

How to get advance license in sales order in ax 2012

Description: -

In this article we will see about how to get advance license and date from sales order in ax 2012.

Here I have given simple demonstration to get advance license and date from sales order if you have export order and you have bind advance license with line then you can get advance license number and date from authorization table. Use below Job to get advance license for particular sales order. 

Example:-

static void GetAdvanceLicense(Args _args)
{
    SalesLine SalesLine;
    SalesTable SalesTable;
    EximSalesLine_IN ObjEximSalesLine_IN;
    EximIncentiveSchemeData_IN ObjEximIncentiveSchemeData_IN;
    EximIncentiveSchemeGroup_IN ObjEximIncentiveSchemeGroup_IN;
    EximProductGroupTable_IN ObjEximProductGroupTable_IN;
    EximAuthorizationSchemesLine_IN  authorizationSchemesLine;
    EximAuthorizationSchemesTable_IN authorizationSchemesTable;
    str 50 Authorization;
    BaseDate AuthoDate;
    SalesId _Salesid;

    _Salesid = SalesOrderNumber';
    Authorization ='';
    AuthoDate = dateNull();
    SalesLine.clear();
    SalesTable.clear();
    ObjEximSalesLine_IN.clear();
    ObjEximIncentiveSchemeData_IN.clear();
    ObjEximIncentiveSchemeGroup_IN.clear();
    ObjEximProductGroupTable_IN.clear();
    authorizationSchemesLine.clear();
    authorizationSchemesTable.clear();

    //While start
    while select * from SalesLine
    join SalesTable
    where SalesTable.SalesId == SalesLine.SalesId
    join ObjEximSalesLine_IN
    where ObjEximSalesLine_IN.SalesLineRecId == SalesLine.RecId
    join ObjEximProductGroupTable_IN
    where ObjEximProductGroupTable_IN.RecId == ObjEximSalesLine_IN.EximProductGroupTable
    join ObjEximIncentiveSchemeGroup_IN
    where ObjEximIncentiveSchemeGroup_IN.RecId == ObjEximSalesLine_IN.EximIncentiveSchemeGroup
    && SalesTable.SalesId == _Salesid
    {
        if(SalesLine.RecId != 0 && ObjEximSalesLine_IN.SalesLineRecId != 0 && ObjEximIncentiveSchemeGroup_IN.RecId != 0 && ObjEximProductGroupTable_IN.RecId != 0)
        {
            select * from ObjEximIncentiveSchemeData_IN
            where ObjEximIncentiveSchemeData_IN.EximIncentiveSchemeGroup == ObjEximIncentiveSchemeGroup_IN.RecId
            && ObjEximIncentiveSchemeData_IN.EximProductGroupTable == ObjEximProductGroupTable_IN.RecId;
            if(ObjEximIncentiveSchemeData_IN.RecId != 0)
            {
                //Get AuthorizationId Here
                Authorization =  EximAuthorizationSchemesTable_IN::findByAuthorizationTypeId(ObjEximIncentiveSchemeData_IN.IncentiveScheme,ObjEximIncentiveSchemeData_IN.AuthorizationId).LicenseNum;
                if (ObjEximIncentiveSchemeData_IN.AuthorizationId)
                {
                    select RecId from authorizationSchemesTable
                        where authorizationSchemesTable.AuthorizationId   == ObjEximIncentiveSchemeData_IN.AuthorizationId
                           && authorizationSchemesTable.AuthorizationType == ObjEximIncentiveSchemeData_IN.IncentiveScheme
                        join reverse firstonly ExportExpiryDate
                            from authorizationSchemesLine
                            order by RecId
                            where authorizationSchemesLine.AuthorizationSchemesTableRecId == authorizationSchemesTable.RecId
                               && authorizationSchemesLine.LicenseStatus                  != EximLicenseStatus_IN::Sold;
                    if(authorizationSchemesTable.RecId != 0)
                    {
                        //Get AuthorizationDate Here
                        AuthoDate = authorizationSchemesLine.ExportExpiryDate;
                        info(strFmt("AuthorizationId = %1, Date.%2",Authorization,authorizationSchemesLine.ExportExpiryDate));
                    }
                }
            }
        }
    }
    //While end
}
Table Name Lookup in Ax 2012

Table Name Lookup in Ax 2012

Description: Here is the code to create Table name lookup in ax 2012.


public void lookup()
{
    SysTableLookup              sysTableLookup = SysTableLookup::newParameters(tablenum(UtilidElements), this);
    Query                       query = new Query();
    QueryBuildDataSource        queryBuildDataSource;
    QueryBuildRange             nameQBR, typeQBR;
    ;
    sysTableLookup.addLookupfield(fieldnum(UtilidElements, Name));
    sysTableLookup.addLookupfield(fieldnum(UtilidElements, Id)); 

    queryBuildDataSource = query.addDataSource(tablenum(UtilidElements)); 

    nameQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, name)); 

    typeQBR = queryBuildDataSource.addRange(fieldnum(UtilidElements, recordType));
    typeQBR.value(SysQuery::value(UtilElementType::Table)); 

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

How to Enable Disable Field in Dialog in SSRS Report in Ax 2012

How to Enable Disable Field in Dialog in SSRS Report in Ax 2012

Description:-
sometimes the report itself have UIBuilder Class that's extends from SRSReportDataContractUIBuilder Class, the report dialog build by this class, if you found that's the report has a UIBuilder Class, you can modify the dialog from it, else if the report doesn't has this Class, chick if the Report has a contract Method UIBuilder for the Report, and make you dialog shows in the way you want.
 
First of all you have to create contract class for that and create method for parameters.

Contract Class:-
[DataContractAttribute, SysOperationContractProcessingAttribute(classstr(SampleUIBuilder))]
class SampleContract implements SysOperationValidatable
{
    NoYesId   IsDiamension;
}


[DataMemberAttribute,SysOperationLabelAttribute("Diamension")]
public NoYesId parmDiamension(NoYesId _IsDiamension = IsDiamension)
{
    IsDiamension = _IsDiamension;
    return IsDiamension;
}

No create UI Builder class and give meaningful name for that
UI Builder Class:-
class SampleUIBuilder extends SysOperationAutomaticUIBuilder
{
    DialogField     dialogDiamension;
    SampleContract SampleContract;
} 


public boolean dialoggetDiamension(FormCheckBoxControl _checkBoxControl)
{
    ;
    dialogToDate.enabled(_checkBoxControl.checked());
}


public void build()
{
    int i;
    SampleContract   contract; 

    contract = this.dataContractObject() as SampleContract;
    dialogDiamension = this.addDialogField(methodStr(SampleContract, parmDiamension),contract);
}


public void postBuild()
{
    SampleContract   contract;
    super();
    contract = this.dataContractObject() as SampleContract;
    dialogDiamension  = this.bindInfo().getDialogField(contract, methodstr(SampleContract, parmDiamension));
    dialogDiamension.registerOverrideMethod(methodstr(FormCheckBoxControl, modified),
        methodstr(SampleUIBuilder, dialoggetDiamension), this);
    //dialogToDate.enabled(any2enum(dialogDiamension.value()));
    if (dialogDiamension)
    {
        dialogDiamension.value();
    }
}


public void postRun()
{
    //super();
}

No create Controller Class for run the report
Controller Class:-
class SampleController extends SrsReportRunController
{
    SampleContract Contract;
}


protected void prePromptModifyContract()
{
    super();
    //if (this.parmArgs() && this.parmArgs().record())
    //{
        Contract = this.parmReportContract().parmRdpContract() as SampleContract;
        Contract.parmDiamension();
    //}
}


public boolean showPrintSettings()
{
    return false;
}


public boolean showQueryValues(str parameterName)
{
    return false;
}


public static void main(Args _args)
{
    SampleController controller;
    controller = new SampleController();
    controller.parmReportName(ssrsReportStr(SSRSReportName, SSRSReportDesignName));
    controller.parmArgs(_args);
    controller.startOperation();
}

Now Create Data Procedure class to run you login and get data from procedure.
Data Procedure Class:-
[SRSReportParameterAttribute(classStr(SampleContract))]
class SampleDp extends SRSReportDataProviderBase
{
    SampleContract contract;
    NoYesId     _IsDeamensionEnable;
    MyTable MyTable;
} 


[SRSReportDataSetAttribute("MyTable")]
public MyTable get MyTable ()
{
    select * from MyTable;
    return MyTable;
}


[SysEntryPointAttribute]
public void processReport()
{
    contract = this.parmDataContract() as SampleContract;
    _IsDeamensionEnable = contract.parmDiamension();
}

No in Visual Studio add the following
1.      Add Report
2.      Add Data Set
1.  Set the Properties for that Data Set.
3.      Set the Parameters you want to set blank value for ItemId Parameters
1.      Allow blank = true
2.      Nullable = true
4.      Add Precision Design
5.      Deployed SSRS Report and Run it.
Multi Select Lookup in SSRS Report in Ax 2012

Multi Select Lookup in SSRS Report in Ax 2012

Description:- Here we will create multi select lookup in ssrs report so we can select multiple data from lookup. Here I have given sample demonstration for how to generate multi select lookup in ssrs report.

First of all you have to create contract class for that and create method for parameters.
Contract Class:-
[DataContractAttribute, SysOperationContractProcessingAttribute(classstr(SampleUIBuilder))]
class SampleContract implements SysOperationValidatable
{
    List  ListItemId;
}


[DataMemberAttribute("Item Id"),AifCollectionTypeAttribute("Item Id", Types::String),
    SysOperationLabelAttribute(literalStr("Item Id"))]
public List parmItemId(List _ListItemId = ListItemId)
{
    ListItemId = _ListItemId;
    return ListItemId;
}

For validation parameters,
public boolean validate()
{
    boolean             isValid = true;
    List            ItemIdList = new List(Types::String);
    ItemIdList = this.parmItemId();
    if(!ItemIdList.elements())
    {
        isValid = checkFailed("ItemId should not be empty");
    }
    return isValid;
}

Now Create AOT Query like below.
No create UI Builder class and give meaningful name for that
UI Builder Class:-
class SampleUIBuilder extends SysOperationAutomaticUIBuilder
{
    DialogField     dialogItemId
    SampleContract SampleContract;
}

private void ItemIdLookup(FormStringControl _control)
{
    Query       query;
    container   conItemId;
    query = new Query(queryStr(ItemListQuery));
    SysLookupMultiSelectGrid::lookup(query,_control,_control,conItemId);
}

public void build()
{
    int i;
    SampleContract   contract;
    contract = this.dataContractObject() as SampleContract;
    dialogItemId = this.addDialogField(methodStr(SampleContract, parmItemId),contract);
}

public void postBuild()
{
    SampleContract   contract;
    super();
    contract = this.dataContractObject() as SampleContract;
    dialogItemId = this.bindInfo().getDialogField(contract,methodStr(SampleContract, parmItemId));
    dialogItemId.registerOverrideMethod(methodStr(FormStringControl, lookup),
        methodStr(SampleUIBuilder, ItemIdLookup),this); 
    if (dialogItemId)
    {
        dialogItemId.lookupButton(2);
    }
}

public void postRun()
{
    //super();
}

No create Controller Class for run the report
Controller Class:-
class SampleController extends SrsReportRunController
{
    SampleContract Contract;
}

protected void prePromptModifyContract()
{
    super();
    //if (this.parmArgs() && this.parmArgs().record())
    //{
        Contract = this.parmReportContract().parmRdpContract() as SampleContract;
        Contract.ParmItemId();
    //}
}

public boolean showPrintSettings()
{
    return false;
}

public boolean showQueryValues(str parameterName)
{
    return false;
}

public static void main(Args _args)
{
    SampleController controller;
    controller = new SampleController();
    controller.parmReportName(ssrsReportStr(SSRSReportName, SSRSReportDesignName));
    controller.parmArgs(_args);
    controller.startOperation();
}

Now Create Data Procedure class to run you login and get data from procedure.
Data Provider Class:-
[SRSReportParameterAttribute(classStr(SampleContract))]
class SampleDp extends SRSReportDataProviderBase
{
    SampleContract contract;
    MyTable MyTable;
}

[SRSReportDataSetAttribute("MyTable")]
public MyTable get MyTable ()
{
    select * from MyTable;
    return MyTable;
} 

[SysEntryPointAttribute]
public void processReport()
{
    List            list = new List(Types::String);
    Query                   queryItemId;
    QueryRun                queryRunItemId;
    InventItemGroupItem     InventItemGroupItem;
    QueryBuildDataSource    qbdsItemId;
    ListIterator            ItemIdListIterator; 

    contract = this.parmDataContract() as SampleContract;
    list = contract.parmItemId();
    if(list != null)
    {
        ItemIdListIterator = new ListIterator(list1);
        queryItemId = new Query(queryStr(ItemListQuery));
        qbdsItemId = queryItemId.dataSourceTable(tableNum(InventItemGroupItem));
        while(ItemIdListIterator.more())
        {
            qbdsItemId.addRange(
                fieldNum(InventItemGroupItem, ItemId)).value(ItemIdListIterator.value());
            ItemIdListIterator.next();
        }
        queryRunItemId = new QueryRun(queryItemId);
        while(queryRunItemId.next())
        {
            InventItemGroupItem = queryRunItemId.get(tableNum(InventItemGroupItem));
            Info(strfmt("ItemId - %1", InventItemGroupItem.ItemId));
        }
    }
}

Now in Visual Studio add the following
1.      Add Report
2.      Add Data Set
1.  Set the Properties for that Data Set.
3.      Set the Parameters you want to set blank value for ItemId Parameters
1.      Allow blank = true
2.      Nullable = true
4.      Add Precision Design
5.      Deployed SSRS Report and Run it.

Floating Value in SSRS Report

Floating Value in SSRS Report

Here in this post we will see about how to set decimal value in real field in SSRS report.

For example:-

If you have real field in your table and while creating SSRS report you want to display only 2 or else 3 floating digit you can use below expression in your SSRS report.

=FORMAT (Date set Field,"N2")

Or else directly you can set floating digit from properties window. Select cell which content real fields and set “FORMAT” property to N2.