Wednesday, December 7, 2016

The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. (rsReportServerDatabaseUnavailable)



Sometimes you may get this error when trying to launch your report server webpage:
The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. (rsReportServerDatabaseUnavailable)
While the error is descriptive enough to let you know that Reporting Services could not find the report server database, it may be a challenge to some who have no idea where this database is and what is it used for. To your surprise, there is more than one database involved.
Reporting Services requires two databases to run:
  • ReportServer
  • ReportServerTempDB
In short, the Report Server database is needed to store report definitions, report history and snapshots, report models, shared data sources, resources, scheduling and delivery information, metadata and several other objects. ReportServerTempDB is where Reporting Services stores session and execution data, cached reports, and work tables that are generated by the report server. For more information about Reporting Services database visit: http://msdn.microsoft.com/en-us/library/ms156016.aspx.
To solve the error mentioned above you need the following information:
  1. What is the SQL Server Reporting Services instance you are trying to reach?
  2. Where are the SQL Server Reporting Services databases hosted?
Assuming you have the right permissions, you will need to run the Reporting Services Configuration Manager and point to the Reporting Services instance as seen on the image below. You would normally find  Reporting Services Configuration Manager under Start->Programs->Microsoft SQL Server 2008 R2->Configuration Tools


Once you connect to your Reporting Services instance through Reporting Services Configuration Manager, go to the  Database tab located on the left pane to view the name of the SQL Server instance where the ReportServer database is being hosted and the name of the ReportServer database as seen in the image below.

the Database Name and SQL Server Name is the main point from where the system will take the connection for reports deployment. 

Keep in mind that in some environments the ReportServer database may be hosted in a separate SQL Server database instance and the ReportServer database may have been renamed to other than the default “ReportServer” database name. You will usually find this type of configuration in a scale-out architecture. For more information on scale-out architecture visit: http://sqlcat.com/technicalnotes/archive/2008/06/05/reporting-services-scale-out-architecture.aspx.
Once you located the SQL Server database instance where the ReportServer and ReportServerTempDB database are hosted you need to follow this checklist:
  1. Is the SQL Server database instance running? Is the SQL Server service started?
  2. Can you verify connectivity to the SQL Server database instance?
  3. Are the ReportServer and ReportServerTempDB databases attached and online?
  4. Does the Reporting Services service account have read/write access to the ReportServer and ReportServerTempDB databases?
Once all of this is verified to be true and issues have been fixed, than the last step would be to restart the Reporting Services instance. If everything is right you should be able to access your reports. It is highly recommended to frequently backup both the ReportServer and ReportServerTempDB databases. If you lose you ReportServer database you may re-deploy reports, data sources and datasets, but you will lose all subscriptions, schedules and report parts that users may have created.
Also, keep in mind that the ReportServerTempDB database does not behave like the SQL Server TempDB. Per MSDN Books on Line:
“Reporting Services does not re-create the temporary database if it is missing, nor does it repair missing or modified tables. Although the temporary database does not contain persistent data, you should back up a copy of the database anyway so that you can avoid having to re-create it as part of a failure recovery operation.” For more details visit:http://msdn.microsoft.com/en-us/library/ms156016.aspx



Sunday, November 20, 2016

Error while setting server report parameters. Error message: The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError) in ax 2012

Error :-

Error while setting server report parameters. Error message: The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError)

Soluction:-  The error mostly occured when we reset or change the password of the account which we are using in the services execution.


After change the password and fill it on the requiered palace we should go tot the SQL Reporting Services Account Configuration.



Choose built in Account from the Service Account and choose the SNK in file location and give a password. That is the temporary information log which could track the details only.

 
After that again login with "USE Another Account " with new password. This will update you password with all the ports and account internally. 

Wednesday, November 2, 2016

Check reservation in ax 2012

Requirement -  

Need to revers the cheque against a payment.

Solution -

Follow the below steps to revers the check.

  1. Click Cash and bank management > Common > Checks.
  2. Select the check to reverse.
  3. Click Payment reversal.
  4. Enter the date and select a reason for the reversal.
  5. Click OK to post the reversal
After this check create a new journal which we can view in Cash and bank management > Journals > Check reversals.

Post these journal and the status of the check will be "Canceled " and the amount will be reflect on supplier also. Follow these steps for post a check reverse journal.

  1. Click Cash and bank management > Journals > Check reversals.
  2. Select the reversal journal to review, and then click Lines.
  3. Review the reversal and select one of the following approval options:
    • To approve and post the reversal journal, click Post or Post and transfer.
    • To reject the reversal, click Delete journal lines. Close the form and then click Delete journal lines again to delete the journal header. Close the form.
 

Monday, October 31, 2016

Functions and expression in SSRS 2012 . include Math Functions, String Functions, Lookup , LookupSet , Decision Functions,Sum ,Row Number,Page Headers and Footers,Page Breaks, Formatting ,Visibility , URLs , Parameters , Group , Null or Zero Values

Many expressions in a report contain functions. You can format data, apply logic, and access report metadata using these functions. You can write expressions that use functions from the Microsoft Visual Basic run-time library, and from the System.Convert and System.Math namespaces. You can add references to functions from other assemblies or custom code. You can also use classes from the Microsoft .NET Framework, including System.Text.RegularExpressions.

Visual Basic Functions

You can use Visual Basic functions to manipulate the data that is displayed in text boxes or that is used for parameters, properties, or other areas of the report. This section provides examples demonstrating some of these functions. For more information, see Visual Basic Runtime Library Members on MSDN.
The .NET Framework provides many custom format options, for example, for specific date formats. For more information, see Formatting Types on MSDN.

Math Functions

  • The Round function is useful to round numbers to the nearest integer. The following expression rounds a 1.3 to 1:
    = Round(1.3)  
    
    
    You can also write an expression to round a value to a multiple that you specify, similar to the MRound function in Excel. Multiply the value by a factor that creates an integer, round the number, and then divide by the same factor. For example, to round 1.3 to the nearest multiple of .2 (1.4), use the following expression:
    = Round(1.3*5)/5  
    
    

Date Functions

  • The Today function provides the current date. This expression can be used in a text box to display the date on the report, or in a parameter to filter data based on the current date.
    =Today()  
    
    
  • The DateAdd function is useful for supplying a range of dates based on a single parameter. The following expression provides a date that is six months after the date from a parameter named StartDate.
    =DateAdd(DateInterval.Month, 6, Parameters!StartDate.Value)  
    
    
  • The Year function displays the year for a particular date. You can use this to group dates together or to display the year as a label for a set of dates. This expression provides the year for a given group of sales order dates. The Month function and other functions can also be used to manipulate dates. For more information, see the Visual Basic documentation.
    =Year(Fields!OrderDate.Value)  
    
    
  • You can combine functions in an expression to customize the format. The following expression changes the format of a date in the form month-day-year to month-week-week number. For example, 12/23/2009 to December Week 3:
    =Format(Fields!MyDate.Value, "MMMM") & " Week " &   
    (Int(DateDiff("d", DateSerial(Year(Fields!MyDate.Value),   
    Month(Fields!MyDate.Value),1), Fields!FullDateAlternateKey.Value)/7)+1).ToString  
    
    
    When used as a calculated field in a dataset, you can use this expression on a chart to aggregate values by week within each month.
  • The following expression formats the SellStartDate value as MMM-YY. SellStartDate field is a datetime data type.
    =FORMAT(Fields!SellStartDate.Value, "MMM-yy")  
    
    
  • The following expression formats the SellStartDate value as dd/MM/yyyy. The SellStartDate field is a datetime data type.
    =FORMAT(Fields!SellStartDate.Value, "dd/MM/yyyy")  
    
    
  • The CDate function converts the value to a date. The Now function returns a date value containing the current date and time according to your system. DateDiff returns a Long value specifying the number of time intervals between two Date values.
    The following example displays the start date of the current year
    =DateAdd(DateInterval.Year,DateDiff(DateInterval.Year,CDate("01/01/1900"),Now()),CDate("01/01/1900"))  
    
    
  • The following example displays the start date for the previous month based on the current month.
    =DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,CDate("01/01/1900"),Now())-1,CDate("01/01/1900"))  
    
    
  • The following expression generates the interval years between SellStartDate and LastReceiptDate. These fields are in two different datasets, DataSet1 and DataSet2. The First Function (Report Builder and SSRS), which is an aggregate function, returns the first value of SellStartDate in DataSet1 and the first value of LastReceiptDate in DataSet2.
    =DATEDIFF(“yyyy”, First(Fields!SellStartDate.Value, "DataSet1"), First(Fields!LastReceiptDate.Value, "DataSet2"))  
    
    
  • The DatePart function returns an Integer value containing the specified component of a given Date value.The following expression returns the year for the first value of the SellStartDate in DataSet1. The dataset scope is specified because there are multiple datasets in the report.
    =Datepart("yyyy", First(Fields!SellStartDate.Value, "DataSet1"))  
    
    
    
  • The DateSerial function returns a Date value representing a specified year, month, and day, with the time information set to midnight. The following example displays the ending date for the prior month, based on the current month.
    =DateSerial(Year(Now()), Month(Now()), "1").AddDays(-1)  
    
    
  • The following expressions display various dates based on a date parameter value selected by the user.
Example DescriptionExample
Yesterday=DateSerial(Year(Parameters!TodaysDate.Value),Month(Parameters!TodaysDate.Value),Day(Parameters!TodaysDate.Value)-1)
Two Days Ago=DateSerial(Year(Parameters!TodaysDate.Value),Month(Parameters!TodaysDate.Value),Day(Parameters!TodaysDate.Value)-2)
One Month Ago=DateSerial(Year(Parameters!TodaysDate.Value),Month(Parameters!TodaysDate.Value)-1,Day(Parameters!TodaysDate.Value))
Two Months Ago=DateSerial(Year(Parameters!TodaysDate.Value),Month(Parameters!TodaysDate.Value)-2,Day(Parameters!TodaysDate.Value))
One Year Ago=DateSerial(Year(Parameters!TodaysDate.Value)-1,Month(Parameters!TodaysDate.Value),Day(Parameters!TodaysDate.Value))
Two Years Ago=DateSerial(Year(Parameters!TodaysDate.Value)-2,Month(Parameters!TodaysDate.Value),Day(Parameters!TodaysDate.Value))

String Functions

  • Combine more than one field by using concatenation operators and Visual Basic constants. The following expression returns two fields, each on a separate line in the same text box:
    =Fields!FirstName.Value & vbCrLf & Fields!LastName.Value   
    
    
  • Format dates and numbers in a string with the Format function. The following expression displays values of the StartDate and EndDateparameters in long date format:
    =Format(Parameters!StartDate.Value, "D") & " through " &  Format(Parameters!EndDate.Value, "D")    
    
    
    If the text box contains only a date or number, you should use the Format property of the text box to apply formatting instead of the Formatfunction within the text box.
  • The RightLen, and InStr functions are useful for returning a substring, for example, trimming DOMAIN\username to just the user name. The following expression returns the part of the string to the right of a backslash (\) character from a parameter named User:
    =Right(Parameters!User.Value, Len(Parameters!User.Value) - InStr(Parameters!User.Value, "\"))  
    
    
    The following expression results in the same value as the previous one, using members of the .NET Framework System.String class instead of Visual Basic functions:
    =Parameters!User.Value.Substring(Parameters!User.Value.IndexOf("\")+1, Parameters!User.Value.Length-Parameters!User.Value.IndexOf("\")-1)  
    
    
  • Display the selected values from a multivalue parameter. The following example uses the Join function to concatenate the selected values of the parameter MySelection into a single string that can be set as an expression for the value of a text box in a report item:
    = Join(Parameters!MySelection.Value)  
    
    
    The following example does the same as the above example, as well as displays a text string prior to the list of selected values.
    =”Report for “ & JOIN(Parameters!MySelection.Value, “ & “)  
    
    
    
  • The Regex functions from the .NET Framework System.Text.RegularExpressions are useful for changing the format of existing strings, for example, formatting a telephone number. The following expression uses the Replace function to change the format of a ten-digit telephone number in a field from "nnn-nnn-nnnn" to "(nnnnnn-nnnn":
    =System.Text.RegularExpressions.Regex.Replace(Fields!Phone.Value, "(\d{3})[ -.]*(\d{3})[ -.]*(\d{4})", "($1) $2-$3")  
    
    
    System_CAPS_ICON_note.jpg Note

    Verify that the value for Fields!Phone.Value has no extra spaces and is of type String.

Lookup

  • By specifying a key field, you can use the Lookup function to retrieve a value from a dataset for a one-to-one relationship, for example, a key-value pair. The following expression displays the product name from a dataset (“Product”), given the product identifier to match on:
    =Lookup(Fields!PID.Value, Fields!ProductID.Value, Fields.ProductName.Value, "Product")  
    
    

LookupSet

  • By specifying a key field, you can use the LookupSet function to retrieve a set of values from a dataset for a one-to-many relationship. For example, a person can have multiple telephone numbers. In the following example, assume the dataset PhoneList contains a person identifier and a telephone number in each row. LookupSet returns an array of values. The following expression combines the return values into a single string and displays the list of telephone numbers for the person specified by ContactID:
    =Join(LookupSet(Fields!ContactID.Value, Fields!PersonID.Value, Fields!PhoneNumber.Value, "PhoneList"),",")  
    
    

Conversion Functions

You can use Visual Basic functions to convert a field from the one data type to a different data type. Conversion functions can be used to convert the default data type for a field to the data type needed for calculations or to combine text.
  • The following expression converts the constant 500 to type Decimal in order to compare it to a Transact-SQL money data type in the Value field for a filter expression.
    =CDec(500)  
    
    
  • The following expression displays the number of values selected for the multivalue parameter MySelection.
    =CStr(Parameters!MySelection.Count)  
    
    

Decision Functions

  • The Iif function returns one of two values depending on whether the expression is true or not. The following expression uses the Iif function to return a Boolean value of True if the value of LineTotal exceeds 100. Otherwise it returns False:
    =IIF(Fields!LineTotal.Value > 100, True, False)  
    
    
  • Use multiple IIF functions (also known as "nested IIFs") to return one of three values depending on the value of PctComplete. The following expression can be placed in the fill color of a text box to change the background color depending on the value in the text box.
    =IIF(Fields!PctComplete.Value >= 10, "Green", IIF(Fields!PctComplete.Value >= 1, "Blue", "Red"))  
    
    
    Values greater than or equal to 10 display with a green background, between 1 and 9 display with a blue background, and less than 1 display with a red background.
  • A different way to get the same functionality uses the Switch function. The Switch function is useful when you have three or more conditions to test. The Switch function returns the value associated with the first expression in a series that evaluates to true:
    =Switch(Fields!PctComplete.Value >= 10, "Green", Fields!PctComplete.Value >= 1, "Blue", Fields!PctComplete.Value = 1, "Yellow", Fields!PctComplete.Value <= 0, "Red",)  
    
    
    Values greater than or equal to 10 display with a green background, between 1 and 9 display with a blue background, equal to 1 display with a yellow background, and 0 or less display with a red background.
  • Test the value of the ImportantDate field and return "Red" if it is more than a week old, and "Blue" otherwise. This expression can be used to control the Color property of a text box in a report item:
    =IIF(DateDiff("d",Fields!ImportantDate.Value, Now())>7,"Red","Blue")  
    
    
  • Test the value of the PhoneNumber field and return "No Value" if it is null (Nothing in Visual Basic); otherwise return the phone number value. This expression can be used to control the value of a text box in a report item.
    =IIF(Fields!PhoneNumber.Value Is Nothing,"No Value",Fields!PhoneNumber.Value)  
    
    
  • Test the value of the Department field and return either a subreport name or a null (Nothing in Visual Basic). This expression can be used for conditional drillthrough subreports.
    =IIF(Fields!Department.Value = "Development", "EmployeeReport", Nothing)  
    
    
  • Test if a field value is null. This expression can be used to control the Hidden property of an image report item. In the following example, the image specified by the field [LargePhoto] is displayed only if the value of the field is not null.
    =IIF(IsNothing(Fields!LargePhoto.Value),True,False)  
    
    
  • The MonthName function returns a string value containing the name of the specified month. The following example displays NA in the Month field when the field contains the value of 0.
    IIF(Fields!Month.Value=0,"NA",MonthName(IIF(Fields!Month.Value=0,1,Fields!Month.Value)))  
    
    
    

Report Functions

In an expression, you can add a reference to additional report functions that manipulate data in a report. This section provides examples for two of these functions. For more information about report functions and examples, see Aggregate Functions Reference (Report Builder and SSRS).
Sum
  • The Sum function can total the values in a group or data region. This function can be useful in the header or footer of a group. The following expression displays the sum of data in the Order group or data region:
    =Sum(Fields!LineTotal.Value, "Order")  
    
    
  • You can also use the Sum function for conditional aggregate calculations. For example, if a dataset has a field that is named State with possible values Not Started, Started, Finished, the following expression, when placed in a group header, calculates the aggregate sum for only the value Finished:
    =Sum(IIF(Fields!State.Value = "Finished", 1, 0))  
    
    
RowNumber
  • The RowNumber function, when used in a text box within a data region, displays the row number for each instance of the text box in which the expression appears. This function can be useful to number rows in a table. It can also be useful for more complex tasks, such as providing page breaks based on number of rows. For more information, see Page Breaks in this topic.
    The scope you specify for RowNumber controls when renumbering begins. The Nothing keyword indicates that the function will start counting at the first row in the outermost data region. To start counting within nested data regions, use the name of the data region. To start counting within a group, use the name of the group.
    =RowNumber(Nothing)  
    
    
You can use expressions to manipulate how data appears on a report. For example, you can display the values of two fields in a single text box, display information about the report, or affect how page breaks are inserted in the report.

Page Headers and Footers

When designing a report, you may want to display the name of the report and page number in the report footer. To do this, you can use the following expressions:
  • The following expression provides the name of the report and the time it was run. It can be placed in a text box in the report footer or in the body of the report. The time is formatted with the .NET Framework formatting string for short date:
    =Globals.ReportName & ", dated " & Format(Globals.ExecutionTime, "d")  
    
    
  • The following expression, placed in a text box in the footer of a report, provides page number and total pages in the report:
    =Globals.PageNumber & " of " & Globals.TotalPages  
    
    
The following examples describe how to display the first and last values from a page in the page header, similar to what you might find in a directory listing. The example assumes a data region that contains a text box named LastName.
  • The following expression, placed in a text box on the left side of the page header, provides the first value of the LastName text box on the page:
    =First(ReportItems("LastName").Value)  
    
    
  • The following expression, placed in a text box on the right side of the page header, provides the last value of the LastName text box on the page:
    =Last(ReportItems("LastName").Value)  
    
    
The following example describes how to display a page total. The example assumes a data region that contains a text box named Cost.
  • The following expression, placed in the page header or footer, provides the sum of the values in the Cost text box for the page:
    =Sum(ReportItems("Cost").Value)  
    
    
System_CAPS_ICON_note.jpg Note

You can refer to only one report item per expression in a page header or footer. Also, you can refer to the text box name, but not the actual data expression within the text box, in page header and footer expressions.

Page Breaks

In some reports, you may want to place a page break at the end of a specified number of rows instead of, or in addition to, on groups or report items. To do this, create a group that contains the groups or detail records you want, add a page break to the group, and then add a group expression to group by a specified number of rows.
  • The following expression, when placed in the group expression, assigns a number to each set of 25 rows. When a page break is defined for the group, this expression results in a page break every 25 rows.
    =Ceiling(RowNumber(Nothing)/25)  
    
    
    To allow the user to set a value for the number of rows per page, create a parameter named RowsPerPage and base the group expression on the parameter, as shown in the following expression:
    =Ceiling(RowNumber(Nothing)/Parameters!RowsPerPage.Value)  
    
    
    For more information about setting page breaks for a group, see Add a Page Break (Report Builder and SSRS).
Expressions are not only used to display data in text boxes. They can also be used to change how properties are applied to report items. You can change style information for a report item, or change its visibility.

Formatting

  • The following expression, when used in the Color property of a text box, changes the color of the text depending on the value of the Profitfield:
    =Iif(Fields!Profit.Value < 0, "Red", "Black")  
    
    
    You can also use the Visual Basic object variable Me. This variable is another way of referring to the value of a text box.
    =Iif(Me.Value < 0, "Red", "Black")
  • The following expression, when used in the BackgroundColor property of a report item in a data region, alternates the background color of each row between pale green and white:
    =Iif(RowNumber(Nothing) Mod 2, "PaleGreen", "White")  
    
    
    If you are using an expression for a specified scope, you may have to indicate the dataset for the aggregate function:
    =Iif(RowNumber("Employees") Mod 2, "PaleGreen", "White")  
    
    
System_CAPS_ICON_note.jpg Note

Available colors come from the .NET Framework KnownColor enumeration.

Chart Colors

To specify colors for a Shape chart, you can use custom code to control the order that colors are mapped to data point values. This helps you use consistent colors for multiple charts that have the same category groups. For more information, see Specify Consistent Colors across Multiple Shape Charts (Report Builder and SSRS).

Visibility

You can show and hide items in a report using the visibility properties for the report item. In a data region such as a table, you can initially hide detail rows based on the value in an expression.
  • The following expression, when used for initial visibility of detail rows in a group, shows the detail rows for all sales exceeding 90 percent in the PctQuota field:
    =Iif(Fields!PctQuota.Value>.9, False, True)  
    
    
  • The following expression, when set in the Hidden property of a table, shows the table only if it has more than 12 rows:
    =IIF(CountRows()>12,false,true)  
    
    
  • The following expression, when set in the Hidden property of a column, shows the column only if the field exists in the report dataset after the data is retrieved from the data source:
    =IIF(Fields!Column_1.IsMissing, true, false)  
    
    

URLs

You can customize URLs by using report data and also conditionally control whether URLs are added as an action for a text box.
  • The following expression, when used as an action on a text box, generates a customized URL that specifies the dataset field EmployeeID as a URL parameter.
    ="http://adventure-works/MyInfo?ID=" & Fields!EmployeeID.Value  
    
    
  • The following expression conditionally controls whether to add a URL in a text box. This expression depends on a parameter named IncludeURLs that allows a user to decide whether to include active URLs in a report. This expression is set as an action on a text box. By setting the parameter to False and then viewing the report, you can export the report Microsoft Excel without hyperlinks.
    =IIF(Parameters!IncludeURLs.Value,"http://adventure-works.com/productcatalog",Nothing)  
    
    
Expressions can be used to manipulate the data that is used in the report. You can refer to parameters and other report information. You can even change the query that is used to retrieve data for the report.

Parameters

You can use expressions in a parameter to vary the default value for the parameter. For example, you can use a parameter to filter data to a particular user based on the user ID that is used to run the report.
  • The following expression, when used as the default value for a parameter, collects the user ID of the person running the report:
    =User!UserID  
    
    
  • To refer to a parameter in a query parameter, filter expression, text box, or other area of the report, use the Parameters global collection. This example assumes that the parameter is named Department:
    =Parameters!Department.Value  
    
    
  • Parameters can be created in a report but set to hidden. When the report runs on the report server, the parameter does not appear in the toolbar and the report reader cannot change the default value. You can use a hidden parameter set to a default value as custom constant. You can use this value in any expression, including a field expression. The following expression identifies the field specified by the default parameter value for the parameter named ParameterField:
    =Fields(Parameters!ParameterField.Value).Value  
    
    
You can use custom code in a report. Custom code is either embedded in a report or stored in a custom assembly which is used in the report. For more information about custom code, see Custom Code and Assembly References in Expressions in Report Designer (SSRS).

Using Group Variables for Custom Aggregation

You can initialize the value for a group variable that is local to a particular group scope and then include a reference to that variable in expressions. One of the ways that you can use a group variable with custom code is to implement a custom aggregate. For more information, see Using Group Variables in Reporting Services 2008 for Custom Aggregation.
Some values in an expression can evaluate to null or undefined at report processing time. This can create run-time errors that result in #Error displaying in the text box instead of the evaluated expression. The IIF function is particularly sensitive to this behavior because, unlike an If-Then-Else statement, each part of the IIF statement is evaluated (including function calls) before being passed to the routine that tests for true or false. The statement =IIF(Fields!Sales.Value is NOTHING, 0, Fields!Sales.Value) generates #Error in the rendered report if Fields!Sales.Value is NOTHING.
To avoid this condition, use one of the following strategies:
  • Set the numerator to 0 and the denominator to 1 if the value for field B is 0 or undefined; otherwise, set the numerator to the value for field A and the denominator to the value for field B.
    =IIF(Field!B.Value=0, 0, Field!A.Value / IIF(Field!B.Value =0, 1, Field!B.Value))  
    
    
  • Use a custom code function to return the value for the expression. The following example returns the percentage difference between a current value and a previous value. This can be used to calculate the difference between any two successive values and it handles the edge case of the first comparison (when there is no previous value) and cases whether either the previous value or the current value is null (Nothing in Visual Basic).
    Public Function GetDeltaPercentage(ByVal PreviousValue, ByVal CurrentValue) As Object  
        If IsNothing(PreviousValue) OR IsNothing(CurrentValue) Then  
            Return Nothing  
        Else if PreviousValue = 0 OR CurrentValue = 0 Then  
            Return Nothing  
        Else   
            Return (CurrentValue - PreviousValue) / CurrentValue  
        End If  
    End Function  
    
    
    The following expression shows how to call this custom code from a text box, for the “ColumnGroupByYear” container (group or data region).
    =Code.GetDeltaPercentage(Previous(Sum(Fields!Sales.Value),"ColumnGroupByYear"), Sum(Fields!Sales.Value))  
    
    
    This helps to avoid run-time exceptions. You can now use an expression like =IIF(Me.Value < 0, "red", "black") in the Color property of the text box to conditionally the display text based on whether the values are greater than or less than 0.

Conversion of Disposition code, code was not specified - Error in D365 F&O for inter company purchase order return

 We crated the return order for inter company purchase order  and created a Item Arrival Journal through Arrival Overview in corresponding c...