diogo.obpa
20th June 2005, 12:00
hi all !
i have a doubt...in session tisfc0202m000 the function put_order_completed is declared as follows:
function extern void tisfc0202m000f.put.order_completed( const domain tcyesno value )
{
DLLUSAGE
Function to set order_completed ( comp.frm ) in session tisfc0202m000
arg: - value to put in order_completed
ENDDLLUSAGE
stpapi.put.field( "tisfc0202m000", "comp.frm", str$(value) )
}
in my script i do
yes = tcyesno.yes
...
dllFunction = "tisfc0202m000f.put.order_completed("& yes &")"
dllname = "otisfc0202m000f"
returnvalue = SendToBaan(dllname, dllFunction)
but when i execute i get an error:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/mobaan/objectos/sessoes_manter/reportar_of_send.asp, line 7
line 7 is the line in blue...what can be the problem ??? :confused: any ideas ?
thanks in advanced,
Diogo
Evert-Jan Bosch
20th June 2005, 15:23
tcyesno is an enumerate only available in Baan 4GL.
In fact it is a long.
I guess you have to use 1 for tcyesno.yes and 2 for tcyesno.no.
evesely
20th June 2005, 15:26
VB doesn't know about the domain tcyesno. It's trying to treat it an an object. In VB, you want to set the value to 1 (which in Baan would be the integral value of tcyesno.yes). Technically, you would want to convert this to a string before doing your concatenation in the 'dllFunction' assignment.
I hope that helps.
minizao
20th June 2005, 18:27
Hi Diogo,
try this :
dllFunction = "tisfc0202m000f.put.order_completed(1)"
dllname = "otisfc0202m000f"
returnvalue = SendToBaan(dllname, dllFunction)
regards,
Nuno
diogo.obpa
21st June 2005, 10:26
thanks to all !!!
it worked but still i get a problem:
i can't insert "yes" value...
dllFunction = "tisfc0202m000f.get.order_completed()"
dllname = "otisfc0202m000f"
returnvalue = SendToBaan(dllname, dllFunction)
order1 = BAANObj.ReturnValue
dllFunction = "tisfc0202m000f.put.order_completed(1)"
dllname = "otisfc0202m000f"
returnvalue = SendToBaan(dllname, dllFunction)
dllFunction = "tisfc0202m000f.get.order_completed()"
dllname = "otisfc0202m000f"
returnvalue = SendToBaan(dllname, dllFunction)
order2 = BAANObj.ReturnValue
then i print to the screen the values of order 1 and order 2 and i get the same vaue to both: 2 which means that order_completed has NO choosen...
ani ideas of can be the problem ???
thanks in advanced,
Diogo
Will@Tait
22nd June 2005, 01:42
Baan doesn't actually set the field value until find or save is called (and maybe when a form command is executed), so when you read before doing one of those actions, you're reading the original value.
I recommend reading the Baan API manual for specifics.
This side of things annoyed the hell out of me too ... why o why don't they set the field value immediately?!?!
diogo.obpa
22nd June 2005, 10:29
hi
it did not worked :( i'm doing the exact same thing in session tisfc0102m000 and it works...it's so frustating...
thanks anyway,
Diogo
mark_h
22nd June 2005, 15:52
I use put and get all the time in debugging function servers. And yes I do use put followed immediately by a get to see what is in a field. I also do this before and after a save to see what happens to values.
The reason it may not update is because some event is not fired in api.mode that would allow you to update this field. Look carefully at what you do manually to complete a production order. I do not have to set this flag. Do you enter a qty complete, then tab to this field? If yes then there are events that fire in the background that may allow this flag to be set to yes. In api.mode these events do not fire until a save/update/continue and some events never get executed. What you may have to do is put the qty complete, then a save or update. Then come back find the record again and then try to set the flag to yes again. I can't really say because I do not know how your system works.
The key to function servers is figuring out what happens where - I have qkey that allows me to see what events fire when. I use this to help me determine how to write the function servers. This is not as good as source, but close enough.