Francesco
14th February 2005, 20:04
For "example":

stpapi.put.field("tipcs2101m000", "tipcs020.cprj", project.series)
stpapi.put.field("tipcs2101m000", "tipcs020.dsca", customer.name)
stpapi.put.field("tipcs2101m000", "tipcs020.dscc", customer.address)
stpapi.put.field("tipcs2101m000", "tipcs020.refe", str$(tccom975.bono))
stpapi.put.field("tipcs2101m000", "tipcs020.seak", strip$(tccom976.part))
stpapi.put.field("tipcs2101m000", "tipcs020.kopr", "3")
stpapi.put.field("tipcs2101m000", "tipcs020.cuno", customer.number)
stpapi.put.field("tipcs2101m000", "tipcs020.ncmp", "001")
stpapi.put.field("tipcs2101m000", "tipcs020.ddat", str$(date.num()))

ret = stpapi.insert("tipcs2101m000", true, error.message)

stpapi.get.field("tipcs2101m000", tipcs020.cprj, project.number)


Obviously the last statement is not working (I knew that!), because the value in the field buffer for the key field (cprj) is the project series rather than the project number (I meant to do that!).

I want to somehow see what actual project number got assigned to my new record without having to do a full query again.
One would think there is an elegant way to do this....but there isn't...or is there?

mark_h
14th February 2005, 22:09
Well I do not know about this session, but on my maintain purchase order session what I do is insert, save, then get purchase order number. The comment I have on the save is "| You must save the record before getting the PO Number" - so not sure if this will work for you on this session. This is the only program I think I actually use a series number on.

Mark

Francesco
14th February 2005, 22:47
project.number still comes up empty.

My interim solution btw:

ret = stpapi.insert("tipcs2101m000", true, error.message)
stpapi.save("tipcs2101m000", error.message)
stpapi.get.field("tipcs2101m000", tipcs020.cprj, project.number)
| Retrieving the new project number.
tcmcs.dll0004.read.default.number(grno, outp, ckon, maxl, seri, eopb, erro)
project.number = str$(outp)


...which gives me the opportunity to draw some attention to my new WIKI chapter: http://www.baanboard.com/twiki/bin/view/Infodevel/TcMcsDll0004

lbencic
14th February 2005, 22:59
I agree with Mark, I have done this a number of times in different sessions and been able to retrieve the generated order number after the save.

Is that the actual syntax? Because in the stpapi.get.field, tipcs020.cprj should be in quotes..right?

Francesco
14th February 2005, 23:07
You're a genius! :D

Is that the actual syntax? Because in the stpapi.get.field, tipcs020.cprj should be in quotes..right?

And I feel really, really stooooopid at this point. lol

Working now. :o

And btw, the extra save is not required. It picks up right after the insert.

lbencic
14th February 2005, 23:14
Well, the WIKI was not a waste, thanks for that.

As for the save - you can do this on the insert, that's what the 'true' is for, or you can put 'false' on the insert and issue the save separate.

mark_h
14th February 2005, 23:31
Sheesh - I did not even look at the syntax. Points to Lisa. And yes I agree that the WIKI was not a waste. I hope I get energetic enough to learn the WIKI one of these days.

Mark