Clearing field after prompting an error message

liizzliizz Member Posts: 125
edited 2012-06-04 in NAV Three Tier
I have put a code on Lookup of a customised table.

IF Balance > Customer."Credit Limit (LCY)" THEN
ERROR(Insert another customer name);
CustName:='';

After prompting the error message, the field CustName should be cleared automatically.

I have assigned it to an empty string but it is not being cleared. I have even used the CLEAR(CustName) too.

Please help..

Thanks
Liizz

Comments

  • ChinmoyChinmoy Member Posts: 359
    edited 2012-06-01
    Try this:

    IF Balance > Customer."Credit Limit (LCY)" THEN BEGIN
    CustName:='';
    ERROR(Insert another customer name);
    END;
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    The Process stops at error message..it will not go to next line..

    If you want to proceed further use Message..
  • liizzliizz Member Posts: 125
    liizz wrote:

    CustName - OnLookup()
    IF Balance > Customer."Credit Limit (LCY)" THEN
    ERROR(Insert another customer name);
    CustName:='';

    The code which I shared, it is showing the error message but it continues further processing.
    Also, I commented the part 'CustName:='';'. It allows processing after the error message.


    Can somebody please clarify me?

    Thanks
    Liizz
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    How do you know that the process is continues further?
  • kinekine Member Posts: 12,562
    liizz wrote:
    liizz wrote:

    CustName - OnLookup()
    IF Balance > Customer."Credit Limit (LCY)" THEN
    ERROR(Insert another customer name);
    CustName:='';

    The code which I shared, it is showing the error message but it continues further processing.
    Also, I commented the part 'CustName:='';'. It allows processing after the error message.


    Can somebody please clarify me?

    Thanks
    Liizz

    Definitely some problem in your analysis. The code is not continuing after the ERROR. If yes, whole NAV will broke... :-) May be in the real code you have message and not error...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ChinmoyChinmoy Member Posts: 359
    It definitely does not process code any further after ERROR statement!!
  • ChinmoyChinmoy Member Posts: 359
    It definitely does not process code any further after ERROR statement, and that is precisely the reason why the CustName variable was not getting cleared.
  • beranberan Member, Microsoft Employee Posts: 80
    It is required to revert the data changes on the server to be ready for the next change of data. This revert of data makes it possible to change the next field eventhough there is an error in the first.
    Eric Beran
    Software Design Engineer II
    Dynamics NAV Office 365
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.