4 Replies Latest reply: Mar 27, 2014 11:05 PM by Deepu Muraleedharan RSS

    How to convert a Databank field from string to integer in OATS?

    IHodgetts

      I have a number of scripts that rely on a databank to store various credentials relating to 10 siteIDs that I iterate through for most of my load tests. Normally this is straightforward within the tree view, but I have recently come across a problem where I need the siteID to be treated as an integer in order to use a routine that generates a digest (based on siteID and HMAC key read from the databank).

       

      The code fragment I'm working with is as follows:

       

      getDatabank("10Sites").getNextDatabankRecord();

      getDatabank("3digitVU").getNextDatabankRecord();

      String siteFromDatabank = "000";

      /** siteFromDatabank = "{{db.10Sites.SiteID,981}}"; DOES NOT WORK - TREATED AS STRING**/

      getVariables().set("siteFromDatabank","{{db.10Sites.SiteID,981}}", Variables.Scope.LOCAL);

       

      info("siteDB=" + siteFromDatabank);

       

      However, I guess I'm mis-using the getVariables (as the documentation mentions this being for diagnostics only)? The above runs, but does not replace the "000" with the value(s) from the databank.


      How would you get the db.10Sites.SiteID read from the databank as an integer (rather than string)?


      Any feedback much appreciated (I'm obviously NOT a Java programmer).


      Ian.