GabrielVA
6th June 2011, 16:16
Hey guys,

I'm trying to create a message popup if a field in the session is blank. This is what I have under my code but its not working. Can someone help give me some feedback?

Thanks

The following is in the field section of the script.

| Get Item Number dependent data if a record exists or clear the
| fields for input if we're adding a record.
select tilit111.mspc:tdlit222.mspc, tilit111.sqap,
tilit111.pmno:tdlit222.pmno
from tilit111
where tilit111._index1 = {:tdpur041.item}
selectdo
selectempty
message("Litton Specific Item Data Not Maintained")
tdlit222.mspc = " "
tdlit222.pmno = " "
tilit111.sqap = " "
|*************************************************************************************
if (tilit111.sqap = " ") then
message("SQAP Not listed. Please contact Deptartment for more info.")
endif
|*************************************************************************************

endselect
display("tdlit222.mspc")
display("tdlit222.pmno")
display("tdlit222.sqap")

spartacus
6th June 2011, 16:30
Does none of both messsages pop up? You can try a message in the "selectdo" part. If it works there .... then you don't reach the "selectempty".

Kind regards
Richard

GabrielVA
6th June 2011, 17:52
I tried it int he selectdo section, still nothing. Any thoughts here?

bdittmar
6th June 2011, 18:41
I tried it int he selectdo section, still nothing. Any thoughts here?

Hello,

compile in debugmode and check if your script is working well.

Regards

mark_h
6th June 2011, 21:27
Also which section in the field is it in? Choice.input, before.display, etc. This will make a difference.

GabrielVA
6th June 2011, 21:50
Hey Mark,
This is what I have,

|****************************** FIELD SECTION ***************************
field.tdlit222.pono:
after.input:
| Get Position Number dependent data if a record exists or clear the
| fields for input if we're adding a record.
select tdlit222.*
from tdlit222
where tdlit222.cmba = {:tdlit222.orno,:tdlit222.pono}
selectdo
selectempty
tdlit222.slso=0
tdlit222.reqs=""
tdlit222.blk1=""
tdlit222.blk2=""
tdlit222.utyp=""
display("tdlit222.slso")
display("tdlit222.reqs")
display("tdlit222.blk1")
display("tdlit222.blk2")
display("tdlit222.ltct")
display("tdlit222.utyp")
endselect

| Get Item Number dependent data if a record exists or clear the
| fields for input if we're adding a record.
select tilit111.mspc:tdlit222.mspc, tilit111.sqap,
tilit111.pmno:tdlit222.pmno
from tilit111
where tilit111._index1 = {:tdpur041.item}
selectdo
|***************************************
if (tilit111.sqap = " ") then
message("SQAP Not listed. Please contact Deptartment for more info.")
endif
|***************************************

selectempty
message("Litton Specific Item Data Not Maintained")
tdlit222.mspc = " "
tdlit222.pmno = " "
tilit111.sqap = " "




endselect
display("tdlit222.mspc")
display("tdlit222.pmno")
display("tdlit222.sqap")

mark_h
6th June 2011, 22:11
Is it working or not working? In debug mode is tdpur041.item set correctly? Is tilit111.sqap a text or string field? You might need to use strip$ to see if it works like "if strip$(tilit111.sqap)= "" then". What is suppose to happen after the message - I usually use set.input.error("") - or do you just want a display message? Also keep in mind the after.input fires after input is entered - not a tab.

GabrielVA
6th June 2011, 22:39
sqap is a display field. I haven't tried with with set.input.error. Let me try this and see, Ill get back to you on that.

ahmer91
7th June 2011, 11:37
use

when.field.changes

vahdani
7th June 2011, 13:21
Hi Gabriel,

your condition is wrong. It says that the field must be equal to one blank charachter! Use the following instead:

if isspace(tilit111.sqap) then
message("SQAP................")
endif

GabrielVA
7th June 2011, 15:34
@vahdani , stupid question, what is 'isspace'?

vahdani
7th June 2011, 15:49
Hi Gabriel,

there are no stupid questions! I myself am still learning new things every day!

isspace() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_string_operations_isspace) is a standard baan function which returns true if the parameter (a string variable or field) is an emtpy string.

GabrielVA
7th June 2011, 20:15
OK thanks! Im still learning here, so any insight you can give me is great!