PowerBuilder Datawindow Problem

Dear Experts

I am using PowerBuilder ver 9.0.3, I have created a datawindow (Free From) in order to make the user to fill Info. to update certain tables using a command button which holds the procedure.

The Datawindow has only four fields, I am using GetItem inside command button to get the data from the four fields for processing.

My problem, if the user forgets to to Press TAB or Enter after entering data in Last Field  the GetItem command will never get the data from that field.

How can I fix that. Datawindow Datawindow
call super::buttonclicked;
setpointer(hourglass!)
vch_no = getitemstring(1,"CUSTOM_VCH_NO")
vch_date = getitemdatetime(1,"CUSTOM_VCH_DATE")
exit_no = getitemstring(1,"CUSTOM_EXIT_NO")
exit_date = getitemdatetime(1,"CUSTOM_EXIT_DATE")

Open in new window

m_jundiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thoyyibCommented:
Call AcceptText() method to applies the contents of the edit control to the current item in the DataWindow control.
kmanoharnaikCommented:
Hi,

You need to call dw_1.AcceptText() in command button's clicked event, which takes the data of current field even if user does not press tab or enter.

this would solve your problem, if no please let me know.

regards
msn
m_jundiAuthor Commented:
Thanks, it worked

I use it before the Getitem :

if accepttext() = 1 then
Getitem.........
end if

Is there a different way of usage ? I mean ,must be in a condition statement ?

Thanks


Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

kmanoharnaikCommented:
hi,

need not be in IF condition statement, but even if you put it works,

Caution: Accepttext() trigegrs itemchanged event, make sure nothing goes wrong when you call Accepttext on itemchanged event.,

regards
msn
kmanoharnaikCommented:
Hi,

better prefix with datawindow controlname.accepttext() to avoid future problems when you add another DW control

thanks
msn
m_jundiAuthor Commented:
Is my syntax correct ?
kmanoharnaikCommented:
yes, but write as below as better coding practice

if dw_1.AcceptText() = 1 then
dw_1.Getitem.........
end if

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
m_jundiAuthor Commented:

"need not be in IF condition statement, but even if you put it works,"

What is the other syntax if it is not in condition format ?

Thanks
kmanoharnaikCommented:
hi,
even we can write directly also without IF condition.

i think better have if conditon, if accepttext() fails, we can track it and display user message.

your code holds good

regards
msn
kmanoharnaikCommented:
hi,

if the solution had worked, please accept the same and share the points.

thanks
manohar
m_jundiAuthor Commented:
Thank you guys
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Sybase Database

From novice to tech pro — start learning today.