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 CRM (Archived)

SSRS Report Issue - argument length must be greater or equal to zero

(0) ShareShare
ReportReport
Posted on by 266

Hi All,

I have a SSRS report in production which is giving an issue "the sortexpression.value expression for the tablix contains an error: argument length must be greater or equal to zero ".

I have 7 expression in the report which are below : Please help to let me know if there is anything unusual in the below expressions which might be causing this issue. Will Appreciate if you give a solution to this issue. Thanks in advance

========
SNo
========
=RowNumber(nothing)


============
Ask Amount
============

=iif(IsNothing(Fields!hex_latestproposalamountValue.Value),Fields!budgetamountValue.Value,Fields!hex_latestproposalamountValue.Value)


============
Notes
============
=Switch(Fields!hex_donortype.Value = "Individual",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!ab_hex_date.Value & " - " & Fields!ab_hex_notes.Value, "ds_getKeyFollowUpOfContactFromOpp")(0),
 Fields!hex_donortype.Value = "Corporate",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value & " - " & Fields!af_hex_notes.Value, "ds_getKeyFollowUpOfAccountFromOpp")(0),
 Fields!hex_donortype.value = "Foundation",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value & " - " & Fields!af_hex_notes.Value, "ds_getKeyFollowUpOfAccountFromOpp")(0),
 Fields!hex_donortype.value = "Government",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value & " - " & Fields!af_hex_notes.Value, "ds_getKeyFollowUpOfAccountFromOpp")(0))


==============================
Date Proposal Started
==============================
=LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!pr_hex_proposaldate.Value,"ds_FirstProposalDate")(0)


=================
DMS Notes Date
=================

=Switch(Fields!hex_donortype.Value="individual",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!ab_hex_date.Value,"ds_getKeyFollowUpOfContactFromOpp")(0),Fields!hex_donortype.Value = "Corporate",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value,"ds_getKeyFollowUpOfAccountFromOpp")(0),Fields!hex_donortype.value = "Foundation",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value,"ds_getKeyFollowUpOfAccountFromOpp")(0),Fields!hex_donortype.value = "Government",LOOKUPSET(Fields!opportunityid.Value,Fields!opportunityid.Value,Fields!af_hex_date.Value,"ds_getKeyFollowUpOfAccountFromOpp")(0))


==============
Pipeline
==============

=Switch(Fields!hex_status.Value="Identification",Fields!hex_identificationcompletion.Value,Fields!hex_status.Value="Cultivation",Fields!hex_cultivationcompletion.Value,Fields!hex_status.Value="Solicitation",Fields!hex_solicitationcompletion.Value)


=============================
Pipeline sorting
=============================

=CInt(Left(Switch(Fields!hex_status.Value="Identification",Fields!hex_identificationcompletion.Value,Fields!hex_status.Value="Cultivation",Fields!hex_cultivationcompletion.Value,Fields!hex_status.Value="Solicitation",Fields!hex_solicitationcompletion.Value), len(Switch(Fields!hex_status.Value="Identification",Fields!hex_identificationcompletion.Value,Fields!hex_status.Value="Cultivation",Fields!hex_cultivationcompletion.Value,Fields!hex_status.Value="Solicitation",Fields!hex_solicitationcompletion.Value)) - 1))

*This post is locked for comments

I have the same question (0)
  • dhawal Profile Picture
    266 on at
    RE: SSRS Report Issue - argument length must be greater or equal to zero

    ErrorFromReport_5F00_ProspectUpdate.png

    Adding the Error Image

  • Suggested answer
    Jarrod Williams Profile Picture
    1,747 on at
    RE: SSRS Report Issue - argument length must be greater or equal to zero

    Hi Dhawal,

    Based on that error message I would say that you have a field that the Tablix is attempting to sort on.  Find that field(s) and then make sure that it has a default value available to it, either in your script or on the field itself.  

  • dhawal Profile Picture
    266 on at
    RE: SSRS Report Issue - argument length must be greater or equal to zero

    Tablix_5F00_Sorting.jpg

    Hi Jarrod, Thanks for responding. I checked the Tablix 1 which was causing the issue. However, I couldn't find any sort expression in the Tablix 1 properties. I am still not able to figure out which field is giving issue. Attaching the screenshot for Tablix 1 Properties with no Sorting Expression. Also, additionally I also tried to remove the fields with expression one by one but still the problem/issue persists. Please help me if you have any other way to understand this.

  • dhawal Profile Picture
    266 on at
    RE: SSRS Report Issue - argument length must be greater or equal to zero

    I found that this particular statement is used in Sorting the Tablix :

    =CInt(Left(Switch(Fields!hex_status.Value="Identification",Fields!hex_identificationcompletion.Value,Fields!hex_status.Value="Cultivation",Fields!hex_cultivationcompletion.Value,Fields!hex_status.Value="Solicitation",Fields!hex_solicitationcompletion.Value), len(Switch(Fields!hex_status.Value="Identification",Fields!hex_identificationcompletion.Value,Fields!hex_status.Value="Cultivation",Fields!hex_cultivationcompletion.Value,Fields!hex_status.Value="Solicitation",Fields!hex_solicitationcompletion.Value)) - 1))

    Can you please help to let me know where can be the problem in this statement to fix the issue?

  • David Jennaway Profile Picture
    14,065 on at
    RE: SSRS Report Issue - argument length must be greater or equal to zero

    It looks like the sortexpression is of the form left([field], len[field] - 1) - i.e. it is taking all but the last character. This will fail if the field is empty, so value will need to check that the field is not empty.

    You should be able to make the expressions more readable by adding a calculated field to determine which field to use (hex_identificationcompletion or hex_cultivationcompletion), then another expression based on this value

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 CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans