alibaba
22nd July 2020, 08:11
Hi Experts:
I tried to get the value from an enum field using the stpapi.get.field() function.
I can use this function to get the value i need from other types of fields.
But an empty value is returned when performed on the enum field.
Is there any special way to use this function on enum fields?

stpapi.get.field("tfacp1230s000", "net.amnt", ACP1230.net.amnt) |
stpapi.get.field("tfacp1230s000", "receipts", ACP1230.receipts)|
stpapi.get.field("tfacp1230s000", "link", ACP1230.link)|
stpapi.get.field(("tfacp1230s000", "approve", ACP1230.approve)


net.amnt/receipts/link/approve is the four fields on the form of tfacp1230s000 , and when run this script, I can get the value of net.amnt/receipts, but the link/approve returns an empty string.

Thanks!

mark_h
22nd July 2020, 15:12
I found one we did before:

domain tcwtst order.status
stpapi.get.field("tdilc1120m000", "tdinv100.wtst",order.stat)
order.status = ltoe(lval(order.stat))


As long as ACP1230.approve and ACP1230 are strings I would expect it to work. I think we only used tfacp1230 in a couple of sessions. I did find this.

| This should start tfacp1230 again
stpapi.zoom.option( "tfacp1110s000", 1, "tfacp1230s000", msg )
msg = stpapi.get.mess.code( "tfacp1110s000" )
| If these do not check out then do a kill and stop everything
| At this point tfacp1230s000 values Not needed 20050719
| stpapi.get.field( "tfacp1230s000", "net.amnt", dummy )
| net.amnt = val(dummy)
| stpapi.get.field( "tfacp1230s000", "receipts", dummy )
| amount = val(dummy)
| stpapi.get.field( "tfacp1230s000", "link", dummy)
| link.rec = ltoe(lval(dummy))
| stpapi.get.field( "tfacp1230s000", "approve", value )
| approve = ltoe(lval(dummy)) | 20050719.end
stpapi.update( "tfacp1230s000", 1, msg )}

alibaba
25th July 2020, 23:17
Thanks mark. But I've tried many times, I always get an empty string on the enum. field.

mark_h
26th July 2020, 16:07
Do you ever process anything thru tfacp1230? Been a while since i have used baan or these sessions, but from the looks of our code those fields should have values. I am wondering if you did an update or something, maybe read the variables afterwards again. Another option if possible - go read the tables directly.

alibaba
26th July 2020, 19:52
Thanks for your suggestion mark, I didn't do anything on session tfacp1230s000, I just tried to get values on the form after it was activated by tfacp1110s000.
I did the same test on other session and found that I couldn't get values from any enum fields. I'm not sure what's causing this, my STPATI.*(ostpapihand) is probably the latest version.

mark_h
27th July 2020, 14:37
Yeah - some of these sessions I could never figure how to get the data out of the form. I finally got to the point if the worked I just skipped trying to get the data. The last one I wrote 4/5 years ago every place tcacp1230 came up I just ended the sessions. I also know in other AFS code I knew the key fields so I just jumped out and read the table.

alibaba
16th August 2021, 12:54
Incredibly, even though I didn't do anything, in today's debugging, I suddenly found that I could get the value of the enumerated field...Why? Because that server was restarted ?

mark_h
16th August 2021, 14:53
Has anything else been done to the company in the last year? What I found in the past in a porting set or one of those Service Packs could make things start working as intended or break stuff.

alibaba
16th August 2021, 15:34
Since asking this question, I have not done any tools or porting set update work. Only the database was updated (got a copy was copied from live environment), and the application server was restarted.(And I used to copy this form to the current VRC, and then deleted it) I just found out about it. Anyway, it can be used, haha.
Thank you for your series of help, mark!