Options

Not blank not working if the user never enters the field

a_developera_developer Member Posts: 20
Hi,

I have the following problem:

In one of my tables I want an integer field to be non-blank and non-zero. I set the property on the field but it only works if the user visits the field. For example:

1. If the user never enters the field the value is allowed to be blank

2. If the user enters the field and then deletes the contents, then not blank works as expected

What should I do?

thank you in advance :)

Comments

  • Options
    PEzechielsPEzechiels Member Posts: 83
    Hi,

    Maybe what you can do is ristrict the user to continue as long as the user hasn't entered a value in your notblank field.
    For instance in the onactivate trigger of all the following controls you can perform a check on your notblank field to see if its empty.......if so send a message and set the focus on your notblank field.


    :-k "Chance Favours The Prepared Mind"
  • Options
    a_developera_developer Member Posts: 20
    I know that I could work around with some coding in the form triggers.

    So let me rephrase: I would like to have the RDBMS NOT NULL equivalent in Navision. No matter what the form checks or not, Navision will not accept a blank value for a new or modified record.
  • Options
    HalMdyHalMdy Member Posts: 429
    Solutions :

    1. Put a "Not blank" default value in the field .

    2. In the OnInsert tigger, check the field and give a message if it's empty

    3. ... ?
  • Options
    PellePelle Member Posts: 18
    In the OnInsert and the OnModify triggers of the table, add this code:

    TESTFIELD("My Fieldname");

    //Pelle
  • Options
    PEzechielsPEzechiels Member Posts: 83
    a_developer:
    dont think such a property exists.

    try coding in table triggers such as oninsert and/or onmodify

    :-k "Chance Favours The Prepared Mind"[/quote]
  • Options
    asramaboyasramaboy Member Posts: 18
    Try this at:

    Form - OnQueryCloseForm(), Form - OnInsert() and Form - OnModify() add coding:

    TESTFIELD("My Fieldname");


    This will only suitable for the record show on the form and the "My Fieldname" is empty.

    If you want to check all the record inside the linkage table the "My Fieldname" is not empty. Try to add some coding at Form - OnQueryCloseForm and add a global variable(Locl variable also can) = Form's linkage table

    TableVar.setrange("My Fieldname", 0); //Form your case "My fieldname is interger
    if tablevar.count <> 0 then
    if tablevar.find('-') then
    Testfield("My Fieldname");
  • Options
    kinekine Member Posts: 12,562
    You can add new field like "Value entered" and OnValidate of the field you can set this new field to true... then you know if someone ever entered something... you cannot decide on the value itself, because value 0 is for navision same thing that "NULL" on MS SQL (but Navision is not using NULL)... but 0 is still value 0 too...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.