GabrielVA
23rd August 2011, 18:41
Im trying to write some code that when a message box pops up it will also disable the save and print buttons. Im editing tdli2122m000. My script I have thus far is:
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
endif
Please help.
Thanks
vahdani
24th August 2011, 11:13
Hi,
There are many ways you can skin a cat! choice.again() is one way you could do this:
choice.update.db:
before.choice:
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
choice.again() |< This stops the choice from executing!!
endif
....
choice.print.data:
before.choice:
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
choice.again() |< This stops the choice from executing!!
endif
Actually if this were a Maintain session, I would use the following:
field.tilit111.sqap:
check.input:
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
set.input.error()
endif
....
choice.update.db:
before.choice:
check.all.input() |< This also stops the choice if a field is not correct!!
....
choice.print.data:
before.choice:
check.all.input()
To really disable the buttons, you can use enable.commands() and disable.commands(). Something like this:
field.tilit111.sqap:
check.input:
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
set.input.error()
disable.commands(PRINT.DATA, UPDATE.DB)
else
enable.commands(PRINT.DATA, UPDATE.DB)
endif
GabrielVA
24th August 2011, 15:28
Thanks vahdani! It looks like the choice.again() works. I tried the disable.command feature but was getting errors in the debug. Ive compiled and Ill toss it into test to see if this stops the user from continuing on with the session. Ill keep you posted, thanks.
GabrielVA
25th August 2011, 20:00
vahdani ,
OK Im new to this. They want to also be able to add in validation with the Item in that table. So if theres nothing in the SQAP and also if the Item field doesnt have "Expense" or "Blanket" in it. Can you help there too? Sorry, Im not use to it yet.
many thanks!
mark_h
28th August 2011, 18:58
Then you would just add a check for that first, then it only checks sqap for items with blanket or expense. I did not do actual code since I do not know your system or how you are using item.
field.tilit111.sqap:
check.input:
if item(1;7) = "BLANKET" or item(1;6) = "EXPENSE" then
if isspace(tilit111.sqap) then
message("SQAP Not listed. Plese check with the Department.")
set.input.error()
endif
endif
GabrielVA
29th August 2011, 14:51
OK Mark,
I think I can I can do it now. Using c4c here. There sure is a lot to learn w BaaN thats for sure! Thanks for the guidance here.