Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Sum of 2 variables or databank values

Options
LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Sum 2 (or more) values of 2 variables or Data Bank values
I have a value that comes from a databank, its name is "Databank1:ValueA".
I have a second value that comes from a second databank, its name is "Databank2:ValueB"

I need to add these 2 values to be sent as a parameter in a XML File.

How can I do this?

Thanks in advance
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    edited November 2016
    Options
    Hello eugenia,

    I'd be happy to help you with this issue.

    The best way to overcome this issue will be to write a script that will add two data source (in this case, both of which are data banks) values and return their sum for use as a parameter.

    Hope this helps! Let me know if there are any additional questions...

    Regards,
    Adam
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hello eugenia,

    I just wanted to follow up with you on this forum topic.

    Has this issue been resolved?

    Regards,
    Adam
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options
    Hi Adam,

    Thanks for your response.
    What I finish doing is this


    var SOAPUtil = Packages.soaptest.api.SOAPUtil

    function AddTwoValues(input, context) {
    var strValueA = context.getDataSourceValueAsString("Databank1: ValueA")
    var strValueB = context.getDataSourceValueAsString("Databank2: ValueB")
    var result = parseInt(strValueA) + parseInt(strValueB)

    return SOAPUtil.getXMLFromString([result.toString()])
    }

    Hello eugenia,

    I just wanted to follow up with you on this forum topic.

    Has this issue been resolved?

    Regards,
    Adam

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Options

    Hi Adam,

    Thanks for your response.
    What I finish doing is this


    var SOAPUtil = Packages.soaptest.api.SOAPUtil

    function AddTwoValues(input, context) {
    var strValueA = context.getDataSourceValueAsString("Databank1: ValueA")
    var strValueB = context.getDataSourceValueAsString("Databank2: ValueB")
    var result = parseInt(strValueA) + parseInt(strValueB)

    return SOAPUtil.getXMLFromString([result.toString()])
    }


    Hello eugenia,

    I just wanted to follow up with you on this forum topic.

    Has this issue been resolved?

    Regards,
    Adam

    Hey eugenia,

    Great! Glad everything worked out.

    Let me know if anything else comes up...

    Regards,
    Adam

Tagged