ttss82
26th February 2002, 14:45
I allready used stpapi.put.field and stpapi.find so this is
set correctly and my current record is set correctly.

I try to retrieve Item description. The problem is the following code in VB:

dim BaanSess as string = "tiitm0101m000"
dim SessField as string = "tiitm001.dsca"
dim ItemDsecription as string = space(30)

BaanObj.ParseExecFunction("ottstpapihand", "stpapi.get.field(" & Chr(34) & BaanSess & Chr(34) & "," & Chr(34) & SessField & Chr(34) & "," & Chr(34) & ItemDescription & Chr(34) & ")")

Field ItemDescription remains empty after this call.

However, if I use

ItemDescription = BaanObj.FunctionCall

I get following result:

ItemDescription = "stpapi.get.field("tiitm0101m000","tiitm001.dsca","W.NR.1.2379 P-PAL*250X20")"

My question is, how can I retrieve the actual value of
tiitm001.dsca which is "W.NR.1.2379 P-PAL*250X20"?

Thanks in advance!

mark_h
26th February 2002, 15:30
I use Excel to run a macro which in turn runs a function server DLL. I needed to get error messages. So I parsed it out like this:

BaanObj.ParseExecFunction dllname, dllfunction
strlen = Len(BaanObj.functioncall)
compos = InStr(1, BaanObj.functioncall, "commmsg:", 1)
msg = Mid(BaanObj.functioncall, compos + 8, strlen - 3)
msg = RTrim(Mid(msg, 1, Len(msg) - 2))

So couldn't you do something like:
itemdescription = mid(itemdescription,XXXX,len(itemdescription)-2)

where XXXX is really where it starts.

Also I believe Al Smith once posted on baanfans a generic VB subroutine to parse out data like this. I can not seem to find it. Maybe someone else has a copy of it.

Good Luck!

Mark

alejandro
26th February 2002, 21:56
Define a function in VB like this

Function GetValueFromStapiGet(fc As String, sn As String, fd As String)
GetValueFromStapiGet = Mid$(fc, 18 + Len(sn) + 3 + Len(fd) + 4)
GetValueFromStapiGet = Left$(GetValueFromStapiGet, Len(GetValueFromStapiGet) - 2)
End Function

Every time you use stapi.get.field, you can call a function like this one. Parameters are:

fc = BaaNObj.FunctionCall
sn = Session Name
fd= Session filed name

It will work for you not depending on length in characters of field you get the value.