I want to retrieve data from Microsoft Dynamics CRM 365 for SSRS. So I made a link between visual studio and the CRM to prepare a RDL file to import it in the CRM. The RDL file will permit to generate the report directly on the CRM.
So, I work on the rdl file and I retrieve the value from a certain field and then I passed the value in many function and it give me an error when the field is empty I don't know why. Here is my code:
= IIf(
IsNothing(Fields!aric_getpartylist.Value) or Fields!aric_getpartylist.Value = "" or Fields!aric_getpartylist.Value = "@" or Fields!aric_getpartylist.Value = " " or Fields!aric_getpartylist.Value = "@@",
nothing,
IIf(
Split(Fields!aric_getpartylist.Value,"@").GetValue(1) = "",
"Reçu par : " & Join(Split(Split(Fields!aric_getpartylist.Value,"@").GetValue(0),"|")," et "),
"Reçu par : " & Join(Split(Split(Fields!aric_getpartylist.Value,"@").GetValue(0),"|")," et ") & " accompagné de " & Join(Split(Split(Fields!aric_getpartylist.Value,"@").GetValue(1),"|")," et ")
)
)
On field which have an empty string like this ""
it give #ERROR
and the fiels with a non-empty string it give the good result !
EDIT:
I try to cut the big function in multiple function in calculate field, so I succeed to isolate the problem:
I thinkg this language precalculate all path of a condition IIF
. Because if I do this:
=IIf(
IsNothing(Fields!something.Value),
nothing,
Split(Fields!something.Value,"@").GetValue(1)
)
It will throw an error if Fields!something.Value
is nothing and it will throw the correct value if it's not.
Because in fact in this language if I do this: Split(nothing,"@").GetValue(1)
it throw an error, so with this test it probably proove that this language probably precalculate the path which permit this error and then throw the error anyway even if the IIF doesn't enter in the path with Split(nothing,"@").GetValue(1)
EDIT2:
I forgot to say that Split(nothing,"@").GetValue(0)
this code doesn't crash with nothing
value. BUT this code do: Split(nothing,"@").GetValue(1)