" /> How to print result of stored procedure using Composer - Genesys CTI User Forum

Author Topic: How to print result of stored procedure using Composer  (Read 2285 times)

Offline dubsky

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
How to print result of stored procedure using Composer
« on: March 20, 2023, 04:45:53 PM »
Advertisement
Hi There,

I am using DB Data block of composer for stored procedure and am able to execute successfully.
I am trying to print the result, for that according to the document i have defined the column name variable and record variable .
[b]In log i can see below assignment.[/b]

Runtime.cxx:462 EvaluateExpression(): Expression [[b]var DBDataWL_VIP1777Data[/b] = {"db_result":[],"db_result_columns":[],"db_outparams":{"RETURN_VALUE":"0","compteur":"1                  "}};]

AssignRuntime.cxx:48 Execute(): Script [AppState.DBDataWL_VIP1777;[b]AppState.DBDataWL_VIP1777[/b]=DBDataWL_VIP1777Data.db_result;]

AssignRuntime.cxx:48 Execute(): Script [AppState.DBDataWL_VIP1777compteur;[b]AppState.DBDataWL_VIP1777compteur[/b]=DBDataWL_VIP1777Data.db_result_columns;]

I want to print  value of "compteur" . Can anyone suggest  how can we print the value of "compteur"



Please find vxml code for DB data block----


<form id="DBDataWL_VIP1777">
<block>
<log gvp:level="1">
<value expr="'Inside the DB data Block'"/>
</log>
<log gvp:level="1">
<value expr="'Result of First variable'+AppState.DBDataWL_VIP1777compteur"/>
</log>
<log gvp:level="1">
<value expr="'Result of Second Variable'+AppState.DBDataWL_VIP1777"/>
</log>
    </block>
<var name="AppStateString" expr="'(' + JSON.stringify(AppState) + ')'" />
<var name="db_query_type" expr="'StoredProcedure'" />
<!-- branch off based on the query type: SQL Query, Query File or Stored Procedure -->
<var name="db_query" expr="'Main_DBDataWL_VIP1777.sql'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_RETURN_VALUE" expr="'return$$INTEGER$${var_Filter_Column}'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_proc_ani" expr="'input$$CHAR$${var_msisdn}'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_compteur" expr="'inout$$CHAR$${var_Stored_Set}'" /><var name="sp_param_list" expr="' RETURN_VALUE proc_ani compteur'"/>
<var name="db_name" expr="'ConnectionProfile'" />
<var name="db_timeout" expr="20" />

<script>
var connProps = new Object();
var customParameters = new Object();
connProps['customParameters'] = customParameters;
</script>
<var name="ConnPropString" expr="'(' + JSON.stringify(connProps) + ')'" />
    <block>
<data name="DBDataWL_VIP1777Data" src="../include/dbrequest.jsp" method="post"
namelist="AppStateString db_query db_query_type db_name db_timeout ConnPropString sp_param_list sp_param_RETURN_VALUE sp_param_proc_ani sp_param_compteur"
enctype="multipart/form-data"
fetchtimeout="22s"/>

        <if cond="typeof DBDataWL_VIP1777Data.errorMsg == 'undefined'">
            <if cond="typeof DBDataWL_VIP1777Data.db_result != 'undefined'">
           
            <assign name="AppState.DBDataWL_VIP1777" expr="DBDataWL_VIP1777Data.db_result" />
           
            <assign name="AppState.DBDataWL_VIP1777compteur" expr="DBDataWL_VIP1777Data.db_result_columns" />

            </if>
            <if cond="typeof DBDataWL_VIP1777Data.db_outparams != 'undefined'">
        <log expr="'db_outparams:' + DBDataWL_VIP1777Data.db_outparams"/>


            <assign name="AppState.var_Filter_Column" expr="DBDataWL_VIP1777Data.db_outparams.RETURN_VALUE" />


            <assign name="AppState.var_Stored_Set" expr="DBDataWL_VIP1777Data.db_outparams.compteur" />
            </if>
    <goto next="#ECMAScript2" />
        <else/>
            <if cond="typeof DBDataWL_VIP1777Data.errorType != 'undefined'">
                <if cond="DBDataWL_VIP1777Data.errorType == 'timeout'">
                <throw event="error.com.genesyslab.composer.dbtimeout" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
                <elseif cond="DBDataWL_VIP1777Data.errorType == 'connectionerror'" />
                <throw event="error.com.genesyslab.composer.dbconnectionerror" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
                </if>
        <else/>
        <throw event="error.com.genesyslab.composer.dberror" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
        </if>
        </if>
</block>
    <catch event="error.com.genesyslab.composer.dberror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbemptyresultset">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbtimeout">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbconnectionerror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.variablemappingerror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
</form>


------Echma Script block to print value----

<form id="ECMAScript2">
<block>
<script>
try {
// your code

AppState.var_Stored_Set= JSON.stringify(DBDataWL_VIP1777Data.db_outparams.compteur);
__Log('Result of Stored Procedure'+AppState.var_Stored_Set);
} catch (error) {
// error handling code
__Log('Code Failure');
}
</script>
<goto next="#Log1" />
</block>
</form>


Thanks in Advance


Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: How to print result of stored procedure using Composer
« Reply #1 on: March 21, 2023, 02:07:56 AM »
Once stored into a Composer variable it is just a Json object. So use basic Javascript concept like dot (.) for object properties.

Object.name
Object.color
Object.array1[0].address

Something like that



Enviado de meu SM-N9600 usando o Tapatalk


Offline dubsky

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: How to print result of stored procedure using Composer
« Reply #2 on: March 21, 2023, 11:50:04 AM »
Hi,

Thanks for replying, I have already mentioned the Echma script code. where I tried JavaScript code to get the compteur value.

------Echma Script block to print value----

<form id="ECMAScript2">
      <block>
        <script>
            try {
                  // your code
                 
                  AppState.var_Stored_Set= JSON.stringify(DBDataWL_VIP1777Data.db_outparams.compteur);
              __Log('Result of Stored Procedure'+AppState.var_Stored_Set);
              } catch (error) {
                  // error handling code
              __Log('Code Failure');
              }
        </script> 
        <goto next="#Log1" />
      </block>
  </form>


--------
But DBDataWL_VIP1777Data this variable is not defined by user it is created in DB Data block. not able to print value from that.
How can i print the value from that.

Runtime.cxx:462 EvaluateExpression(): Expression [var DBDataWL_VIP1777Data = {"db_result":[],"db_result_columns":[],"db_outparams":{"RETURN_VALUE":"0","compteur":"1                  "}};]

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: How to print result of stored procedure using Composer
« Reply #3 on: March 21, 2023, 01:23:39 PM »
The suffix Data is just an add-on to the real variable name. I guess in your DB block you chose which variable will store the result, right?


Enviado de meu SM-N9600 usando o Tapatalk


Offline dubsky

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: How to print result of stored procedure using Composer
« Reply #4 on: March 21, 2023, 04:23:41 PM »
Hi,

I have defined the column variable and record variable in DB data block
AppState.DBDataWL_VIP1777, AppState.DBDataWL_VIP1777compteur

[b]Please find below vxml code[/b]

<?xml version="1.0" encoding="utf-8"?>
<vxml version="2.1" xml:lang="en-US"
xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gvp="http://www.genesyslab.com/2006/vxml21-extension" application="../src/ComposerRoot.vxml">


<!-- VXML code generated by Composer 8.1.540.07 -->
<!-- Diagram created by Composer: Composer 8.1.541.07 -->
<!-- Project version: 8.1.541.07 -->
<!-- Diagram version: 1.0 CreatedOn:  -->
<!-- Application Author:  -->
<!-- Release Mode: false -->

<!-- Global Scripts includes -->
<script src="../include/common.js" />
<script src="../include/ctic.js" />
<script src="../include/json.js" />
<script src="../include/DataAccess.js" />

<!-- Global Vars declarations -->
<script>
var AppState = new Object();
AppState.System = new Object();
AppState.System.RetainInputTypeVariableDefaultValue = false;
AppState.CallUUID = session.connection.uuid;
AppState.ANI = getANI();
AppState.DNIS = getDNIS();
AppState.USE_LCASE_USERDATAKEY = initSystemTypeVariable('USE_LCASE_USERDATAKEY',0);
 
  if (session.connection.protocol.sip.headers != undefined &amp;&amp;
    session.connection.protocol.sip.headers['x-genesys-gvp-session-id']){
AppState.GVPSessionID = session.connection.protocol.sip.headers['x-genesys-gvp-session-id'];
AppState.g_CTICCall = isCTICCall(AppState.GVPSessionID);
} else {
AppState.GVPSessionID = 'undefined';
AppState.g_CTICCall = 'false';
}
 

AppState.APP_ASR_LANGUAGE = initSystemTypeVariable('APP_ASR_LANGUAGE','en-US');
AppState.APP_LANGUAGE = initSystemTypeVariable('APP_LANGUAGE','en-US');
AppState.APP_OPM = initSystemTypeVariable('APP_OPM',eval('('+session.connection.protocol.sip.requesturi['parameters']+')'));
AppState.ChoixMenu = undefined;
AppState.COMPOSER_WSSTUBBING = initSystemTypeVariable('COMPOSER_WSSTUBBING','0');
AppState.dummy = '';
AppState.EnableFCR = initSystemTypeVariable('EnableFCR',true);
AppState.EnableReports = initSystemTypeVariable('EnableReports',false);
AppState.EnableSNMP = initSystemTypeVariable('EnableSNMP',false);
AppState.GRAMMARFILEDIR = initSystemTypeVariable('GRAMMARFILEDIR','../Resources/Grammars');
AppState.ivr_route = 'ACC';
AppState.LAST_EVENT_ELEMENT = initSystemTypeVariable('LAST_EVENT_ELEMENT','undefined');
AppState.LAST_EVENT_LINE = initSystemTypeVariable('LAST_EVENT_LINE','undefined');
AppState.LAST_EVENT_MSG = initSystemTypeVariable('LAST_EVENT_MSG','undefined');
AppState.LAST_EVENT_NAME = initSystemTypeVariable('LAST_EVENT_NAME','undefined');
AppState.LAST_EVENT_URL = initSystemTypeVariable('LAST_EVENT_URL','undefined');
AppState.msisdn = '';
AppState.numentered = undefined;
AppState.OCS_Record = initSystemTypeVariable('OCS_Record',getCallflowOCSRecord());
AppState.OCS_RecordURI = initSystemTypeVariable('OCS_RecordURI',getCallflowRecordURI());
AppState.OCS_URI = initSystemTypeVariable('OCS_URI',getCallflowOCSURI());
AppState.PREV_APP_ASR_LANGUAGE = initSystemTypeVariable('PREV_APP_ASR_LANGUAGE','undefined');
AppState.PREV_APP_LANGUAGE = initSystemTypeVariable('PREV_APP_LANGUAGE','undefined');
AppState.SCRIPTSDIR = initSystemTypeVariable('SCRIPTSDIR','../Scripts');
AppState.svi_lang = undefined;
AppState.VOXFILEDIR = initSystemTypeVariable('VOXFILEDIR','../Resources/Prompts');
AppState.clientidentif = undefined;
AppState.choixsortie = undefined;
AppState.var_ConnectionString = undefined;
AppState.var_Stored_Set = 0;
AppState.var_Stored_Record = undefined;
AppState.var_Filter_Column = undefined;
AppState.var_msisdn = '';
AppState.DBDataWL_VIP1777compteur = undefined;
AppState.DBDataWL_VIP1777 = undefined;
AppState.DBDataWL_VIP1777_mapping = [];
</script>


<!-- Global Scripts -->
<script srcexpr="AppState.VOXFILEDIR + '/PromptSwitch.js'" />
<script srcexpr="AppState.VOXFILEDIR + '/en-US/en-US.js'" />
<script>var f = new Format();</script>


<script srcexpr="AppState.VOXFILEDIR + '/en-US/customprompts.js'" />


<!-- Global Properties declarations -->
<property name="com.genesyslab.logtoasr" value="false" /> 
<property name="com.genesyslab.loglevel" value="5" />

<!-- Metadata information -->
<meta name="com.genesyslab.studio.resourcePath" content="/Callflows/Main.callflow"/>

<!-- Global links -->
<form>
<block>
<log expr="'Running Main workflow.'"/>
<log expr="'Code Generated by Composer: 8.1.540.07.'"/>
<log expr="'Diagram created/upgraded by Composer: Composer 8.1.541.07.'"/>
<log expr="'Project version: 8.1.541.07.'"/>
<log expr="'Diagram version: 1.0 CreatedOn: .'"/>
<goto next="#Entry1" />
</block>
</form>
<!-- This is the Entry block -->
<form id="Entry1">
<block name="Entry">
<goto next="#Assign2" />
</block>
</form>

<catch event="connection.disconnect.hangup">
<assign name="AppState.LAST_EVENT_ELEMENT" expr="_element"/>
    <assign name="AppState.LAST_EVENT_MSG" expr="_message"/>
    <assign name="AppState.LAST_EVENT_NAME" expr="_event"/>
    <assign name="AppState.LAST_EVENT_LINE" expr="_line"/>
    <assign name="AppState.LAST_EVENT_URL" expr="_url"/>
<script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#ActionStart2" />
    </catch>
<catch event="error">
<assign name="AppState.LAST_EVENT_ELEMENT" expr="_element"/>
    <assign name="AppState.LAST_EVENT_MSG" expr="_message"/>
    <assign name="AppState.LAST_EVENT_NAME" expr="_event"/>
    <assign name="AppState.LAST_EVENT_LINE" expr="_line"/>
    <assign name="AppState.LAST_EVENT_URL" expr="_url"/>
<script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#ActionStart2" />
    </catch>
<catch event=".">
<assign name="AppState.LAST_EVENT_ELEMENT" expr="_element"/>
    <assign name="AppState.LAST_EVENT_MSG" expr="_message"/>
    <assign name="AppState.LAST_EVENT_NAME" expr="_event"/>
    <assign name="AppState.LAST_EVENT_LINE" expr="_line"/>
    <assign name="AppState.LAST_EVENT_URL" expr="_url"/>
<script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#ActionStart2" />
    </catch>   
   

<!-- This is the Exit block -->
<form id="Exit1">
<block>
<exit/>
  </block>
</form>

<!-- This is the Assign block -->
<form id="French">
<block>

<assign name="AppState.svi_lang" expr="'FR'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the Assign block -->
<form id="English">
<block>

<assign name="AppState.svi_lang" expr="'EN'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart1">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Start|parentID=Main</log>
<goto next="#ActionEnd1" />
    </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd1">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Start|UNKNOWN</log>


<goto next="#ECMAScript1" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart2">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Deconnexion_Debut</log>
<goto next="#ActionEnd2" />
    </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd2">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Deconnexion_Debut|UNKNOWN</log>


<goto next="#Exit1" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart3">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_English|parentID=Main</log>
<goto next="#ActionEnd3" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart4">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_French|parentID=Main</log>
<goto next="#ActionEnd4" />
    </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd3">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_English|UNKNOWN</log>


<goto next="#English" />
    </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd4">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_French|UNKNOWN</log>


<goto next="#French" />
    </block>
</form>

<!-- This is the InteractionDataBlock block -->
<form id="InteractionData1">
<property name="com.genesyslab.externalevents.enable" value="false"/>
      <property name="com.genesyslab.externalevents.queue" value="true"/>
     
<block>
<if cond="AppState.g_CTICCall == 'false'" >
<script>
var choixsortie = AppState.choixsortie;
</script>
    <gvp:send namelist="choixsortie" async="false"/>
<else/>
<!--  CTIC Case -->
<script>
var Action = "AttachData";
var sub_action = "Add";
var choixsortie = AppState.choixsortie;
</script>
<gvp:send namelist="Action sub_action choixsortie" async="false"/>
    <gvp:receive maxtime="10s"/>
<if cond="isCTICResult( application.lastmessage$ ) == 'false'">
    <throw event="error.com.genesyslab.composer.receiveerror" messageexpr="'The received message has invalid content-type.'" />
    </if>
   
    <var name="InteractionData1Message" expr="application.lastmessage$.content"/>
<var name="arrUserData" expr="getUserDataArray(InteractionData1Message)"/>
<var name="InteractionData1Result" expr="utilGetReceiveDataValue('Result', arrUserData)" />
               
<if cond="InteractionData1Result != 'SUCCESS'">
<var name="InteractionData1ResultReason" expr="utilGetReceiveDataValue('reason', arrUserData)" />
<if cond="InteractionData1ResultReason == 'Timeout'">
<throw event="error.com.genesyslab.composer.operationtimeout" messageexpr="InteractionData1ResultReason" />
<else/>
<throw event="error.com.genesyslab.composer.receiveerror" messageexpr="InteractionData1ResultReason" />
</if>
</if>
</if>
    <goto next="#Exit1" />
  </block>
</form>

<!-- This is the DB Data block -->
[b]<form id="DBDataWL_VIP1777">[/b]
<block>
<log gvp:level="1">
<value expr="'Inside the DB data Block'"/>
</log>
<log gvp:level="1">
<value expr="'Result of First variable'+AppState.DBDataWL_VIP1777compteur"/>
</log>
<log gvp:level="1">
<value expr="'Result of Second Variable'+AppState.DBDataWL_VIP1777"/>
</log>
    </block>
<var name="AppStateString" expr="'(' + JSON.stringify(AppState) + ')'" />
<var name="db_query_type" expr="'StoredProcedure'" />
<!-- branch off based on the query type: SQL Query, Query File or Stored Procedure -->
<var name="db_query" expr="'Main_DBDataWL_VIP1777.sql'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_RETURN_VALUE" expr="'return$$INTEGER$${var_Filter_Column}'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_proc_ani" expr="'input$$CHAR$${var_msisdn}'" />
<!-- Define parameters to be used for stored procedure prepared statement -->
<var name="sp_param_compteur" expr="'inout$$CHAR$${var_Stored_Set}'" /><var name="sp_param_list" expr="' RETURN_VALUE proc_ani compteur'"/>
<var name="db_name" expr="'ConnectionProfile'" />
<var name="db_timeout" expr="20" />

<script>
var connProps = new Object();
var customParameters = new Object();
connProps['customParameters'] = customParameters;
</script>
<var name="ConnPropString" expr="'(' + JSON.stringify(connProps) + ')'" />
    <block>
<data name="DBDataWL_VIP1777Data" src="../include/dbrequest.jsp" method="post"
namelist="AppStateString db_query db_query_type db_name db_timeout ConnPropString sp_param_list sp_param_RETURN_VALUE sp_param_proc_ani sp_param_compteur"
enctype="multipart/form-data"
fetchtimeout="22s"/>

        <if cond="typeof DBDataWL_VIP1777Data.errorMsg == 'undefined'">
            <if cond="typeof DBDataWL_VIP1777Data.db_result != 'undefined'">
           
            <assign name="AppState.DBDataWL_VIP1777" expr="DBDataWL_VIP1777Data.db_result" />
           
            <assign name="AppState.DBDataWL_VIP1777compteur" expr="DBDataWL_VIP1777Data.db_result_columns" />

            </if>
            <if cond="typeof DBDataWL_VIP1777Data.db_outparams != 'undefined'">
        <log expr="'db_outparams:' + DBDataWL_VIP1777Data.db_outparams"/>


            <assign name="AppState.var_Filter_Column" expr="DBDataWL_VIP1777Data.db_outparams.RETURN_VALUE" />


            <assign name="AppState.var_Stored_Set" expr="DBDataWL_VIP1777Data.db_outparams.compteur" />
            </if>
    <goto next="#ECMAScript2" />
        <else/>
            <if cond="typeof DBDataWL_VIP1777Data.errorType != 'undefined'">
                <if cond="DBDataWL_VIP1777Data.errorType == 'timeout'">
                <throw event="error.com.genesyslab.composer.dbtimeout" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
                <elseif cond="DBDataWL_VIP1777Data.errorType == 'connectionerror'" />
                <throw event="error.com.genesyslab.composer.dbconnectionerror" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
                </if>
        <else/>
        <throw event="error.com.genesyslab.composer.dberror" messageexpr="DBDataWL_VIP1777Data.errorMsg" />
        </if>
        </if>
</block>
    <catch event="error.com.genesyslab.composer.dberror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbemptyresultset">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbtimeout">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.dbconnectionerror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
    <catch event="error.com.genesyslab.composer.variablemappingerror">
    <script>storeCallflowException(_element, _message, _event, _line, _url)</script> 
<goto next="#Br_Identif" />
        </catch>
</form>

<!-- This is the Branching block -->
<form id="Br_Identif">
<block>
<if cond="AppState.clientidentif=='OK'">

<!-- This is the OutLink -->
<goto next="#AccueilChoixLang" />
</if>
<if cond="AppState.clientidentif=!'OK'">

<!-- This is the OutLink -->
<goto next="#MsgIdentif" />
</if>
<goto next="#MsgIdentif" />
</block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd5">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_VoixSms|UNKNOWN</log>


<goto next="#Assign1" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Assign1">
<block>

<assign name="AppState.choixsortie" expr="'VoixSms'" />
<goto next="#InteractionData1" />
</block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart5">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_VoixSms</log>
<goto next="#ActionEnd5" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Assign3">
<block>

<assign name="AppState.choixsortie" expr="'OM'" />
<goto next="#InteractionData1" />
</block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd6">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_OM|UNKNOWN</log>


<goto next="#Assign3" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart6">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_OM</log>
<goto next="#ActionEnd6" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart7">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Internet|parentID=Main</log>
<goto next="#ActionEnd7" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Assign4">
<block>

<assign name="AppState.choixsortie" expr="'Internet'" />
<goto next="#InteractionData1" />
</block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd7">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Internet|UNKNOWN</log>


<goto next="#Assign4" />
    </block>
</form>

<!-- This is the Exit block -->
<form id="Exit2">
<block>
<exit/>
  </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd9">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Lingala|UNKNOWN</log>


<goto next="#Lingala" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Lingala">
<block>

<assign name="AppState.svi_lang" expr="'LI'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart9">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Lingala</log>
<goto next="#ActionEnd9" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Swahili">
<block>

<assign name="AppState.svi_lang" expr="'SW'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart10">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Swahili</log>
<goto next="#ActionEnd10" />
    </block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd10">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Swahili|UNKNOWN</log>


<goto next="#Swahili" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart11">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Tshiluba</log>
<goto next="#ActionEnd11" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Tshiluba">
<block>

<assign name="AppState.svi_lang" expr="'TS'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd11">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Tshiluba|UNKNOWN</log>


<goto next="#Tshiluba" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="Kikongo">
<block>

<assign name="AppState.svi_lang" expr="'KI'" />
<goto next="#HNO?" />
</block>
</form>

<!-- This is the ActionEndBlock block -->
<form id="ActionEnd12">
<block>
<log label="com.genesyslab.var.ActionEnd" gvp:cond="AppState.EnableReports">1222_Kikongo|UNKNOWN</log>


<goto next="#Kikongo" />
    </block>
</form>

<!-- This is the ActionStartBlock block -->
<form id="ActionStart12">
<block>
<log label="com.genesyslab.var.ActionStart" gvp:cond="AppState.EnableReports">1222_Kikongo</log>
<goto next="#ActionEnd12" />
    </block>
</form>

<!-- This is the Log block -->
<form id="Log1">
    <block>
    <goto next="#Br_Identif" />
    </block>
</form>

<!-- This is the Assign block -->
<form id="ECMAScript1">
<block>
<script>
try {
// your code

AppState.var_msisdn=AppState.ANI;
__Log('The ANI value is  '+AppState.var_msisdn);
AppState.var_msisdn='&quot;' + AppState.var_msisdn + '&quot;';
__Log('The ANI value in string  '+AppState.var_msisdn);

} catch (error) {
// error handling code
}
</script>
<goto next="#DBDataWL_VIP1777" />
</block>
</form>

<!-- This is the Assign block -->
<form id="ECMAScript2">
<block>
<script>
try {
// your code

AppState.var_Stored_Set= JSON.stringify(DBDataWL_VIP1777Data.db_outparams.compteur);
__Log('Result of Stored Procedure'+AppState.var_Stored_Set);
} catch (error) {
// error handling code
__Log('Code Failure');
}
</script>
<goto next="#Log1" />
</block>
</form>

<!-- This is the AccueilChoixLang block in Disabled mode -->
<form id="AccueilChoixLang">
    <block>
    <goto next="#ActionStart4" />
    </block>
</form>

<!-- This is the Assign2 block in Disabled mode -->
<form id="Assign2">
    <block>
    <goto next="#ActionStart1" />
    </block>
</form>

<!-- This is the MsgIdentif block in Disabled mode -->
<form id="MsgIdentif">
    <block>
    <goto next="#Exit2" />
    </block>
</form>

<!-- This is the HNO? block in Disabled mode -->
<form id="HNO?">
    <block>
    <goto next="#MessClosed" />
    </block>
</form>

<!-- This is the MessClosed block in Disabled mode -->
<form id="MessClosed">
    <block>
    <goto next="#Exit2" />
    </block>
</form>

<!-- This is the Qualification block in Disabled mode -->
<form id="Qualification">
    <block>
   
    </block>
</form>

</vxml>

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: How to print result of stored procedure using Composer
« Reply #5 on: March 21, 2023, 06:06:00 PM »
try getting the value of your variable var_Filter_Column. It should contain the return result of your Stored Procedure

Offline dubsky

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: How to print result of stored procedure using Composer
« Reply #6 on: March 22, 2023, 08:13:30 AM »
Hi,

"var_Filter_Column"  this variable is storing value of "sp_param_RETURN_VALUE"  which is define in DB block as below code line--
  <var name="sp_param_RETURN_VALUE" expr="'return$$INTEGER$${var_Filter_Column}'" />

I want to get value of "compteur" which is different from "sp_param_RETURN_VALUE"

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: How to print result of stored procedure using Composer
« Reply #7 on: March 22, 2023, 01:49:19 PM »
Ahh I see... well, probably your variable AppState.var_Stored_Set already has this value after the database execution

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: How to print result of stored procedure using Composer
« Reply #8 on: March 23, 2023, 10:47:57 PM »

As said, the Data suffix is just temporary withing MCP execution, use the Variable you set at the DB Block. Try this code

[code]
try {
                  // your code
                 
                  AppState.var_Stored_Set= DBDataWL_VIP1777.db_outparams.compteur;
              __Log('Result of Stored Procedure'+AppState.var_Stored_Set);
              } catch (error) {
                  // error handling code
              __Log('Code Failure');
              }[/code]