How to write conditions in SSRS report design

Scenario: A report has a field  namely Pallet  and Packing  weight  which  should  be visible  if  there is  BR markID  present for  that  record  else Both  label  and Value should be hidden

How  to  write condition  in Visual Studio:

Step1: go the Text  box which  you  want to hide  based  on the condition–> Right Click –>TextBox properties


Step2: Select  visibility  –>Show or hide based on an expression–> write the required expression  /condition.img2.JPGimg3

This  expression implies: If  value of  BRmarkid is  null  then hide  my field  else  show it . Here true  implies to hide and False means to show.

Syntax: IIF(Condition,result  when condition is  true, result when condition is  false).

Steps  need to  be repeated  for  all the textboxes which  need to  work  based on the condition.

Note:  Make  sure  the name for  the field  is  different and Unique as otherwise it  will lead to  compilation error  for  expressions even if you  write  expression /condition correctly.




How to find related Dataset in Website under Enterprise portal?

Document handling Form in Enterprise portal

Enterprise Portal integrates Microsoft Dynamics AX document management functionality with the Microsoft SharePoint user interface.

Therefore, users can accomplish many of the same document management tasks from Enterprise Portal that they can accomplish from the Document handling form in the Microsoft Dynamics AX client application.

For example, users can accomplish the following tasks from Enterprise Portal:

  • Add or delete a document (note or file) from a Microsoft Dynamics AX record.
  • View or edit the properties of a document that is attached to a Microsoft Dynamics AX record.
  • Open a document that is attached to a Microsoft Dynamics AX record.
  • View a list of all documents for single record or a specific record type.
  • View a list of the latest documents for a single record or a list of Microsoft Dynamics AX records.


Requirement Overview: In EP While attaching a document if for that Document type if user clicks on HideOnEP checkbox (Not in Standard; it’s a customization)

Path to  DocuType Form:-   Organisation administration -> Set Up -> Document Management -> Document types

 If on client application this is how Document Type Form is:DocumentTypesAXForm

then expected outcome on EP is following (please refer to  Highlighted record in the image below for easy understanding):


Requirement is If we click on checkbox HideOnEP then it should hide on EP  and Should not  be visible to the Table for  which  we have attached the Document Type with.

Now if the Document Type form looks like below:DocumentTypesAXForm1

Then on EP We won’t Find the highlighted /selected Document type  enlisted in Type ID lookup as shown below :EpFOrm2

To  Achieve this  functionality  We need to  know  where to  write  code and We cannot  personalize the form to  see datasource as we see in client application but  Since in AX 2012 AOT  We have Web where we have EP <relatedForm> datasets where either methods can be written if required  or  can identify  which .cs class can  be modified.

Identifying the Dataset.

 Step1: Go to that form /Page in Enterprise portal  modifications needs to  be done. For current  requirement path followed is:  System administration à Setup à Enterprise Portal à Web Sitesà

View in browser. On the Web page click on Sales tab


On clicking Attachment following form will  get  opened:EPForm4

Step2: Right click on Text Field against Type and click on Inspect element (see Image below):


After clicking on Inspect element, following screen will appear:


Step 3:

To find the source for the field where you want to make a change or implement a functionality. Click  on left topmost  icon    and click on Type  ID on the EP  form  , the source script will  get  highlighted and there you  can find the Dataset  behind that.


Step 4:

Open AOT in Ax Client Application àWeb à WebFiles à Web Controlsà EPDocuInfoAdd



(Go  to  this WebControl  ; Here you  can see the class with  c sharp  code for  this  web control)

Step 5:

Open visual studio in your development environment and run it as administrator.


Step 6:  In Visual Studio, go to  view tab and click on Application explorer  and right click on EPDocuInfoAdd and click on EDIT , a script will  get  opened. Now go to View Tab again and open Solution explorer and open EPDocuInfoAdd.ascx.cs


The code on Left side is the place where we need to write our business Logic. For this task, modification in Lookup was required so you can search using AXLookup keyword as it is a framework class and is used to create lookups in EP as shown in code snippet below:CSCode1

The code to achieve required functionality involves using proxy so that we can add a range to our required field i.e. hideOnEP. Refer to the code snippet below:CSCode2

Here Range has been given where it means that if Hide on EP is checked on console application then for that value in lookup will not be visible.

Step 7: Deploy  Element in AOT


Step 8: Refresh AOD , data and dictionary  for  changes to  get  reflected in EP. Refer to following:



Happy Daxing!!! 🙂

Using Comma IO (File Operations)

Task: ExportData toCSV 

Getting the list of Sales Quotations and Sales orders that  are linked to  several cases.

static void ExportDataToCSV(Args _args)
CommaIO commaIO;
FileName fileName;
CaseAssociation caseAssociation, caseAssociationloc;
SalesQuotationTable salesQuotationTable;
SalesTable salesTable;
CaseDetailBase casedetailBase;

fileName = WINAPI::getTempPath() + “@WSL2967” + “.csv”;
commaIO = new CommaIO(fileName,’W’);

commaIO.write(“@SYS177726″,”@SYS4081954″,”@WSL569″,”@WSL2810”); //Label names of what  we need  in excel.

while select count(RecId),RefRecId,EntityType from caseAssociation
group by caseAssociation.RefRecId, caseAssociation.EntityType
where caseAssociation.EntityType == CaseEntityType::SalesTable
|| caseAssociation.EntityType == CaseEntityType::SalesQuotation
if(caseAssociation.RecId > 1)
if(caseAssociation.EntityType == CaseEntityType::SalesTable)
salesTable = salesTable::findRecId(caseAssociation.RefRecId);
while select caseRecID from caseAssociationloc
where caseAssociationloc.RefRecId == caseAssociation.RefRecId
&& caseAssociationloc.EntityType == CaseEntityType::SalesTable
casedetailBase = CaseDetailBase::findRec(caseAssociationloc.CaseRecId);
if(salesTable.salesid != “” && casedetailBase.CaseId != “”)
salesQuotationTable = SalesQuotationTable::findRec(caseAssociation.RefRecId);
while select caseRecID from caseAssociationloc
where caseAssociationloc.RefRecId == caseAssociation.RefRecId
&& caseAssociationloc.EntityType == CaseEntityType::SalesQuotation
casedetailBase = CaseDetailBase::findRec(caseAssociationloc.CaseRecId);
if(salesQuotationTable.QuotationId != “” && casedetailBase.CaseId != “”)