deviceofmisery
13th December 2010, 03:50
Hello,
I try to run this in VS2008 (C#):
...
Baan4.Baan4Class BaanIVObj;
BaanIVObj = new Baan4.Baan4Class();
string Session = "tipcs2101m000";
string Field = "tipcs020.cprj";
BaanIVObj.FunctionCall = "stpapi.get.field(\"" + Session + "\", \"" + Field + "\", ReturnValue)";
int test = BaanIVObj.ParseExecFunction("ottstpapihand", BaanIVObj.FunctionCall);
showResult(BaanIVObj);
...
but the error occures "syntax error in function call". What is wrong?
mark_h
13th December 2010, 15:49
Maybe this recent thread http://www.baanboard.com/baanboard/showthread.php?t=59691will help. See how he calls ottstpapihand.
deviceofmisery
14th December 2010, 04:13
Hi mark_h,
what the hell is all that and where can I read something about it?
what is:
string sf = string.Format("olesql_parse(\"{0}\")", qry);
or
b.ParseExecFunction("ottdllsql_query", sf);
or
sf = string.Format("olesql_fetch({0})", handle);
b.ParseExecFunction("ottdllsql_query", sf);
i have never seen all of that!
i have no idea right now how this can help me!?!?!
deviceofmisery
14th December 2010, 10:19
Thanks mark_h,
i got it work to read from baan:
BaanIVObj.ParseExecFunction("ottstpapihand", String.Format("stpapi.find(\"{0}\",\"{1}\")", Session, ""));
string sParams = string.Format("stpapi.get.field(\"{0}\",\"{1}\",\"{2}\")", Session, Field1, ret);
BaanIVObj.ParseExecFunction("ottstpapihand", sParams);
but went i try:
string strDscc = "Test Dicc Input";
sParams = string.Format("stpapi.put.field(\"{0}\",\"{1}\",\"{2}\")", Session, Field3, strDscc);
BaanIVObj.ParseExecFunction("ottstpapihand", sParams);
sParams = string.Format("stpapi.update(\"{0}\",1,\"{1}\")", Session, ret);
BaanIVObj.ParseExecFunction("ottstpapihand", sParams);
sParams = string.Format("stpapi.save(\"{0}\",\"{1}\")", Session, ret);
BaanIVObj.ParseExecFunction("ottstpapihand", sParams);
i looks like the update was successful and no error occures, but when I open Baan to check whether it worked, the "Field3" is still empty. Is theree something wrong about the "stpapi.update" or "stpapi.save" or do I have another thing wrong?
mark_h
14th December 2010, 15:47
This syntax is beyond my grasp. But from just glancing at it it looks there should be 3 fields to stpapi.update has three fields - as far as I know the stpapi.update("tdsls4105s000, 1, error). Check the sticky thread at top of this forum for the syntax. In this case the 1 means do the update.
deviceofmisery
15th December 2010, 03:27
Hi mark_h,
but after the line:
sParams = string.Format("stpapi.update(\"{0}\",1,\"{1}\")", Session, ret);
sParams is "stpapi.update("tdsls4105s000",1,"ret")" like ind your expamle the stpapi.update("tdsls4105s000, 1, error).
mark_h
15th December 2010, 15:08
As I mentioned the syntax is beyond my skill set. The only other thing I can recommend is that if you have the baan source code then put it in debug mode and step through the code to see what happens. I did just notice that this is a subsession - tdsls4105s000. I take it you code calls the main session which activates the subsession?
deviceofmisery
16th December 2010, 03:01
Sry mark_h,
no i don't use that session, i just took the name from your example.
My session is tipcs2101m000 with subsession tcmcs0547s000 (e.g).
Somehow Update is running now. Next Step it that "Zoom"-thing into subsession. But therefor i first have to check the order of steps ( insert(), zoom.option(), handle.subproc(), etc. )
thanks
mark_h
16th December 2010, 14:24
This is the only code I found in the forum - tipcs2101m000 (http://www.baanboard.com/baanboard/showthread.php?t=24768&highlight=tipcs2101m000). This shows some code to insert in tipcs2101m00. Then the normal process would be insert, handle.subproc, and then zoom. The handle comes before you execute the command that initiates the subsession.