Spotfire write back: problems with parameters

Hi, I have an IronPython 2.7.7 script for iserting a row in database.  

I have followed the the steps:

-I have created and stored procedure at the database with the following code:

CREATE OR REPLACE PROCEDURE insertTESTE_PROCEDURE(

     p_flag IN char,

     p_txt IN VARCHAR2,

     p_coment IN VARCHAR2)

IS

BEGIN

 if(length(nvl(p_txt,''))>0 and length(nvl(p_flag,''))>0  ) then

  INSERT INTO teste_procedure t

        VALUES (p_flag, p_txt, p_coment);

       else 

        INSERT INTO teste_procedure t

        VALUES ('O', 'NULL', 'NULL');

 end if;

 

  COMMIT;

END;

-I have created an stored procedure (pre type) at spofire with the id "97ffbdb9-74bc-45e5-ac09-a962b77de18b"

-I have created an Information link with the stored procedure and a query returning 1 with id "a42b532a-bdc4-4252-bb2b-ca500ab1ec0e"

And I have created an script for getting the marked row, a comment and a flag and insert into the databse. Although I get no erros messages, the script only inserts the values for empty parameters, even though they are not empty. Can anyone help me? 

from System import Array,Guid,String,Object

from Spotfire.Dxp.Data.Import import InformationLinkDataSource, InformationLinkParameter

from Spotfire.Dxp.Data import *

################Get marked data##############################

#dataTable is a DataTable script parameter. 

markedRows = Document.ActiveMarkingSelectionReference.GetSelection(amostra)

print "Selected rows:\t" + str(markedRows.IncludedRowCount) #same as str(markedRows.AsIndexSet().Count

print "Total rows:\t"    + str(markedRows.TotalRowCount)

print "Hidden rows:\t"   + str(markedRows.ExcludedRowCount)

#Loop through marked rows. "symbol" is a column name

for r in markedRows.AsIndexSet(): 

   print "row # " + str(r) + " value:\t" + amostra.Columns["ID"].RowValues.GetFormattedValue(r)



Document.Properties["pTxt"]=amostra.Columns["ID"].RowValues.GetFormattedValue(r)

Document.Properties["pFlag"]="V"

################INSERT Data#####################################

###  Get value from three document property###

Parameter=Document.Properties["pTxt"]

TableParameter=Document.Properties["pFlag"]

TableParameter1=Document.Properties["pComentario"]

############################

### Create an array for each parameter###

a=Array.CreateInstance(str,1)

a[0]=Parameter

b=Array.CreateInstance(str,1)

b[0]=TableParameter

c=Array.CreateInstance(str,1)

c[0]=TableParameter1

#########################################

###Create info link paramter (The GUI id is Store procedure element Id)

ilParam1 = InformationLinkParameter.CreateReferencedParameter(Guid("97ffbdb9-74bc-45e5-ac09-a962b77de18b"),"p_flag",a)

ilParam2 = InformationLinkParameter.CreateReferencedParameter(Guid("97ffbdb9-74bc-45e5-ac09-a962b77de18b"),"p_txt",b)

ilParam3 = InformationLinkParameter.CreateReferencedParameter(Guid("97ffbdb9-74bc-45e5-ac09-a962b77de18b"),"p_coment",c)

#############################################

#############executing info link

ilDataSource = InformationLinkDataSource("a42b532a-bdc4-4252-bb2b-ca500ab1ec0e", [ilParam1,ilParam2,ilParam3])

ds=Document.Data.Tables.Add("tmp",ilDataSource)

Document.Data.Tables.Remove("tmp")

Table.Refresh() ########Refreshing user table , We need to pass data table name for this parameter

      

#Document.Properties["pTxt"] =''

#Document.Properties["pFlag"]=''

#Document.Properties["pComentario"]=''

(1) Answer

Login