How to check the field null

shibilyshibily Member Posts: 89
Hi,
Any body know how to check the field in a form ( Not table field ) is blank ?


Thanks in advance

Shibily

Comments

  • rajpatelbcarajpatelbca Member Posts: 178
    you can use testfields function to check field in code.
    eg.
    Record.TESTFIELD(Field, [Value])

    Customer.TESTFIELD("No.")

    u can set it by using property also.

    Notblank of text box.

    hope it will help u.
    Experience Makes Man Perfect....
    Rajesh Patel
  • bbrownbbrown Member Posts: 3,268
    IF YourVAR = '' THEN...
    There are no bugs - only undocumented features.
  • BeliasBelias Member Posts: 2,998
    if for "field" you mean something in a texbox, it's not correct.
    in a textbox you can insert a field value but also a global variable, a function, a sum of these elements (for example)
    so, look at the textbox properties, find sourcexpr property and then test the nullity of whatever you have inserted there
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • shibilyshibily Member Posts: 89
    you can use testfields function to check field in code.
    eg.
    Record.TESTFIELD(Field, [Value])

    Customer.TESTFIELD("No.")

    u can set it by using property also.

    Notblank of text box.

    hope it will help u.

    raj
    Actually i am using the employee card. I want to validate the Employee.No.. text box
  • BeliasBelias Member Posts: 2,998
    ah...ok...now it's clear...
    employee.testfield("no.");
    
    what's wrong with it?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • rajpatelbcarajpatelbca Member Posts: 178
    shibily wrote:
    raj
    Actually i am using the employee card. I want to validate the Employee.No.. text box
    try this
    testfields("No.")

    let me know if it not work.
    Experience Makes Man Perfect....
    Rajesh Patel
  • BeliasBelias Member Posts: 2,998
    we're all posting together... :mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • rajpatelbcarajpatelbca Member Posts: 178
    ok Belias solve this problem.

    no problem.
    Experience Makes Man Perfect....
    Rajesh Patel
  • shibilyshibily Member Posts: 89
    shibily wrote:
    raj
    Actually i am using the employee card. I want to validate the Employee.No.. text box
    try this
    testfields("No.")

    let me know if it not work.


    I tried IF TESTFIELD("No.") then
    MESSAGE('Enter anything.!!!');

    but. i am getting an error message indicating this is a void expression there must be true false expression.
  • rajpatelbcarajpatelbca Member Posts: 178
    see here is the example of customer you can do this for employee also.


    These examples show how to use the TESTFIELD function.

    Without Value:

    Customer."No." := '';
    Customer.TESTFIELD("No.")

    This code returns an error message:

    You must specify No.in Customer No.=''
    Experience Makes Man Perfect....
    Rajesh Patel
  • rajpatelbcarajpatelbca Member Posts: 178
    if you are writing like this
    if testfields("No.") then

    testfield function will not return value thats why it is giving u an error.
    it will raise error message if u do not enter value in it.


    the second way.

    if employee."no."='' then
    message('test');
    end;

    now is it clear ?
    Experience Makes Man Perfect....
    Rajesh Patel
  • BeliasBelias Member Posts: 2,998
    ok Belias solve this problem.

    no problem.

    take it easy, I was joking :mrgreen::mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
Sign In or Register to comment.