Forum Discussion

Petewilson's avatar
Petewilson
Contributor
6 years ago

Parametrise xmlcheckpoint name

 

Hi all,

 

I am looking to try and parameterise a function to check the xml generated against the baseline saved in TC.

i have simplified the code below, but my question is can i parameterise the actual checkpoint name, i.e. 'XML.XmlCheckpoint1' in the below? I can parameterise the actual xml source but i want to use this function multiple times in a loop, so want it to select the correct xml file from the Stores

 

XML.XmlCheckpoint1.Check(param1);

 

procedure XML_Compare;
var
  param1;
  param2;
begin
  param1 :=  'C:\\Work\\Data.xml';
  param2 := Project.Variables.Driver.value('XMLCheckpointName');
  XML.XmlCheckpoint1.Check(param1);
end;
  • You're using DelphiScript so it's a bit trickier.  Basically, you're going to want to use the "Evaluate" function

     

    Something like

     

    Evaluate('XML.' + CheckpointName + '.Check(param1)')

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You're using DelphiScript so it's a bit trickier.  Basically, you're going to want to use the "Evaluate" function

     

    Something like

     

    Evaluate('XML.' + CheckpointName + '.Check(param1)')

    • Petewilson's avatar
      Petewilson
      Contributor

      Thank you Mysterious Gremlin Master  ;)

       

      DelphiScript is something i have inherited unfortunately, so thank you very much for your help.

       

      That solved it for me.