Skip to Content
0

Variable from a previos SQL Call always comes blank despite it has a value

Jan 13, 2017 at 05:24 AM

88

avatar image
Former Member

Hi Everyone.

I'm quite new on B1IF and I have this strange problem that I'm sure that you guys could help me on this:

I'm working on a Scenario step where I need to do SQL Call and then put that result into a variable to use it in another SQL Call. When I do a XSL transformation this is working and printing the correct value:

<vDocFROMSAPCardCode>

<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@id='atom9']/jdbc:ResultSet/jdbc:Row/jdbc:CardCode"></xsl:value-of>

</vDocFROMSAPCardCode2>

This will print the value, However if I try to assign this to a Local Variable called vFROMSAPCardCode:

/vpf:Msg/vpf:Body/vpf:Payload[./@id='atom20']/vDocFROMSAPCardCode2

Always comes empty. I need to use the result of that query in another query but always comes blank, despite the logic seams to be OK.

# SELECT T0."DocNum", T0."DocEntry", T0."CardCode", T0."NumAtCard"  FROM ORDR T0 WHERE T0."CardCode" =  '$vFROMSAPCardCode' 

Does anyone know what am I missing here? Or how to use the result of a previous query into antoher one?

BTW.

atom9 Is the original query that it's working fine

atom20 is the XSL transformation after the query is executed.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
avatar image
Former Member Feb 07, 2017 at 10:30 AM
0

Hello Manuel,

Probably problem is in variable - application cannot use variable if you put it directly in Call SQL Atom. I would suggest to use construction like one below (make a statement in XSL atom and call it in SQL atom):

        <SQLStatement xmlns="">
            <xsl:variable name="CardName" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='X']/xx/Code"></xsl:variable>             <Statement1>
                select * from "CRD1" Adr inner join "OCRD" BP
on Adr."CardCode"=BP."CardCode" where Adr."U_NN" =  '<xsl:value-of select="$CardName"></xsl:value-of>' order by Adr."AdresType";
         </Statement1>
        </SQLStatement>

It will help you to see what query exactly was used.

Hope it will help you!

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks a lot.

This solved my problem.

0