Search code examples
crystal-reportscrystal-reports-xi

Crystal Reports Get value of specified id


i got an xml file in crystal report which is build like that:

Columns:  ID     value
          1      4
          2      7
          3      99

now I want to save the values with the ID of 2 and 3 in a formula for later use. But how do I do that?

I tried to make create two formulas who look like this:

Shared stringVar value1;
if({XMLFile.ID} = 2) then
value1:= {XMLFile.Value}

and

Shared stringVar value2;
if({XMLFile.ID} = 3) then
value2:= {XMLFile.Value}

But if I display them in the "details" area of my report only one number is displayed. There is no selection filter or anything and these values exist.


Solution

  • I finally got it to work.

    I just added the XML file twice. So my formulas look like that

    Shared stringVar value1;
    if({XMLFile.ID} = 2) then
    value1:= {XMLFile.Value}
    

    and

    Shared stringVar value2;
    if({XMLFile_copy.ID} = 3) then
    value2:= {XMLFile_copy.Value}