vinceco252
27th June 2002, 19:11
I have an AFS with a function to put all of the fields for the session. At the end of the function, there is an insert:
stpapi.insert ( "tdsls9190m000", 1, error)
Everything works fine until this statement. When this statement executes, I get a BW Message with the following error statements:
1: process 1 - Fatal Error : Arg error stpapi.insert(124): (LONG, expected: STRING|BASED)
2: process 1 - Fatal Error: Can not continue in ttstpoledaem in DLL: ottstpapihand (get.company)
Has anyone else had a similar problem? Does anyone have any suggestions?
Thanks in advance.
Vince
mark_h
27th June 2002, 19:21
How is error declared? It should be string. Also if you could post the code it might help someone else see what is wrong.
Thanks
Mark
vinceco252
27th June 2002, 19:42
Mark,
Sorry for the lack of detail. The stpapi.insert is actually in another function. HEre is the call to that function:
f9190m000.insert(errmsg)
errmsg is declared in the declarations section as:
extern string errmsg(200)
Here is the f9190m000.insert function:
function extern void f9190m000.insert( ref string error )
{
DLLUSAGE
Function to insert a record in session tdsls9190m000
Fields must be put before calling this function
ENDDLLUSAGE
stpapi.insert( "tdsls9190m000", 1, error )
}
I hope this provides enought info. If not, please let me know.
Thanks,
Vince
gfasbender
27th June 2002, 19:52
I would bet that you have passed the incorrect variable value (a string instead of a long) in one of your stpapi.put.field() calls before the insert call.
vinceco252
27th June 2002, 22:07
Gordon,
Thanks for the tip. I thought it might be something like that. Can someone tell me one more thing? How do you pass enumerated values through a put.field? Do you use the straight integer representaion, a string integer representation, or the enum value? (i.e., 1, "1", or "tcyesno.yes")
Thanks for the help.
Vince
gfasbender
27th June 2002, 22:13
stpapi.put.field(sess, fld, "tcyesno.yes")
vinceco252
27th June 2002, 22:34
Thanks Gordon. That could be the reason I was getting the other error as well, because I was passing it as an integer (long). I will post when I get it working. Thanks again for the help.
Vince
vinceco252
1st July 2002, 19:38
Ok, I htink I'm getting there. One mroe thing, though: how do you pass dates from VB to the DLL? (i.e., data type, format)
Thanks,
Vince
gfasbender
1st July 2002, 20:25
stpapi.put.field(sess, fld, "07012002")
When "mmddyyyy" is the date format used for dates at your site. Run the session and see what your date format is.
mark_h
1st July 2002, 23:12
On a query(from VB) I did I had to change the date format - so I did:
Dim date_f, date_t, date_mark As Date
date_f = Format(date_f, "yyyy,m,d")
then the query did a date.to.num(). As far as the API code what Gordon posted is correct.
Mark
vinceco252
1st July 2002, 23:24
Gordon and Mark,
Thanks for all your help. I finally got a record written into my development environment today!
Thanks again,
Vince