Options

Dissable message box while validating Item?

bangswitbangswit Member Posts: 265
hi all
i have sales invoice for example Shipment date is 08/17/10
and today is 09/22/10

after I add another item in this Invoice it would be message like this
Shipment Date 08/17/10 is before Workdate 09/22/10

how do I disabled it?
because i made report to import data
there're a lot of data, and it's very annoying to click OK for these messages after i import it
does anybody know how to disabled it while i import?
thanks

Answers

  • Options
    navuser1navuser1 Member Posts: 1,329
    bangswit wrote:
    hi all
    i have sales invoice for example Shipment date is 08/17/10
    and today is 09/22/10

    after I add another item in this Invoice it would be message like this
    Shipment Date 08/17/10 is before Workdate 09/22/10

    how do I disabled it?
    because i made report to import data
    there're a lot of data, and it's very annoying to click OK for these messages after i import it
    does anybody know how to disabled it while i import?
    thanks

    Just debug the code and find the area.
    Remember where you have to set validation in the Sales Line Table at the of importing the data.
    Now or Never
  • Options
    AndwianAndwian Member Posts: 627
    PRELIMINARY:
    What are your efforts in this?
    What have you tried to do?

    TECHNICAL SIDE:
    The Importing Processes mimic the manual process of creating Sales Invoice.
    Since you know the repro step, i.e. the condition that the message will occur, I think you could utililize the Debugger to see where it comes from.

    Once you get it, you can remark the code MESSAGE(Shipment Date %1 is before Workdate %2).

    Usually, it is in the field OnValidate on the table.

    FUNCTIONAL SIDE:
    From the message it clearly stated that the Shipment Date of the line will be created (get from the Header) is BEFORE than the WORKDATE, hence simply change your workdate to the very earliest possible date, e.g. 01/01/10.
    I believe the message now will be skipped.
    Regards,
    Andwian
  • Options
    bangswitbangswit Member Posts: 265
    Andwian wrote:
    PRELIMINARY:
    What are your efforts in this?
    What have you tried to do?

    TECHNICAL SIDE:
    The Importing Processes mimic the manual process of creating Sales Invoice.
    Since you know the repro step, i.e. the condition that the message will occur, I think you could utililize the Debugger to see where it comes from.

    Once you get it, you can remark the code MESSAGE(Shipment Date %1 is before Workdate %2).

    Usually, it is in the field OnValidate on the table.

    FUNCTIONAL SIDE:
    From the message it clearly stated that the Shipment Date of the line will be created (get from the Header) is BEFORE than the WORKDATE, hence simply change your workdate to the very earliest possible date, e.g. 01/01/10.
    I believe the message now will be skipped.

    yes because i think it's because i validate the item no.
    but can i dissabled this message box without touching the sales line table?
  • Options
    AndwianAndwian Member Posts: 627
    bangswit wrote:
    but can i dissabled this message box without touching the sales line table?
    Yes, just do the FUNCTIONAL SIDE workaround suggestion mentioned above.
    Regards,
    Andwian
  • Options
    bangswitbangswit Member Posts: 265
    Andwian wrote:
    bangswit wrote:
    but can i dissabled this message box without touching the sales line table?
    Yes, just do the FUNCTIONAL SIDE workaround suggestion mentioned above.

    i think i should do in the technical side....
  • Options
    AndwianAndwian Member Posts: 627
    Why don't just change the workdate temporarily to earlier date?
    It is very simple and do not need any programming.
    Regards,
    Andwian
  • Options
    bangswitbangswit Member Posts: 265
    Andwian wrote:
    Why don't just change the workdate temporarily to earlier date?
    It is very simple and do not need any programming.
    because maybe the user want to user workdate as they want
    and i dont want to change that....
    we, the technical side maybe can change what they want without changing workdate they want to use
  • Options
    AndwianAndwian Member Posts: 627
    You could try the technical way then.

    Good luck!
    Regards,
    Andwian
  • Options
    kinekine Member Posts: 12,562
    If you check the code, where the messagebox is displayed, you will find out that there is condition. You can set the flag to not show the dialogs through function SetHideValidationDialog on the table before you call the OnValidate. Why to do it in a hard way when you need to just call one function? 8) :whistle:
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    AndwianAndwian Member Posts: 627
    kine wrote:
    You can set the flag to not show the dialogs through function SetHideValidationDialog on the table before you call the OnValidate. Why to do it in a hard way when you need to just call one function?
    Wow! That's cool! =D> I've just known that! :thumbsup:

    Thank you, Kamil!
    Regards,
    Andwian
  • Options
    bangswitbangswit Member Posts: 265
    kine wrote:
    If you check the code, where the messagebox is displayed, you will find out that there is condition. You can set the flag to not show the dialogs through function SetHideValidationDialog on the table before you call the OnValidate. Why to do it in a hard way when you need to just call one function? 8) :whistle:

    SetHideValidationDialog ?
    where should i put it?
    in table 37 which is that is the table i want to insert in
    where can i find SetHideValidationDialog ?
  • Options
    bangswitbangswit Member Posts: 265
    in sales line
    i want to disabled this one
    Shipment Date - OnValidate()
    .
    .
    .
    .
    .
    .
      IF "Shipment Date" < WORKDATE THEN
          IF NOT HasBeenShown THEN BEGIN
            MESSAGE(
              Text014,
              FIELDCAPTION("Shipment Date"),"Shipment Date",WORKDATE);
            HasBeenShown := TRUE;
          END;
    .
    .
    .
    .
    .
    .
    .
    .
    
  • Options
    kinekine Member Posts: 12,562
    As you can see, there is not used the variable I mentioned, thus you have two possibilities:

    1) Add own condition and function to set the flag
    2) Add function to set variable HasBeenShown which is already used in condition for this statement
    3) Backup the curren workdate, set the workdate back to some date, validate the field, and restore the workdate.

    You didn't wrote the NAV version you are on. There are differences between the versions in this standard functionality...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    bangswitbangswit Member Posts: 265
    kine wrote:
    As you can see, there is not used the variable I mentioned, thus you have two possibilities:

    1) Add own condition and function to set the flag
    2) Add function to set variable HasBeenShown which is already used in condition for this statement
    3) Backup the curren workdate, set the workdate back to some date, validate the field, and restore the workdate.

    You didn't wrote the NAV version you are on. There are differences between the versions in this standard functionality...
    so before validate item in my report, i should make HasBeenShown := TRUE; ??
  • Options
    kinekine Member Posts: 12,562
    For example, yes... through some function on the table... it is one way.

    Or you do not need to change the table, only your report and do something like:
    BackupDate := WORKDATE;
    WORKDATE := ShipmentDate;
    VALIDATE("Shipment Date",ShipmentDate);
    WORKDATE := BackupDate;

    as already suggested few times...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    bangswitbangswit Member Posts: 265
    but what i want to validate is item no
    still failed
    BackupDate := WORKDATE;
    WORKDATE := ShipmentDate;
    .
    .
    .
    .
    SalesLine.VALIDATE(SalesLine."Shipment Date",ShipmentDate);
    SalesLine.VALIDATE(SalesLine."Cross-Reference No.",ItemCode);
    .
    .
    .
    .
    WORKDATE := BackupDate;
    
  • Options
    kinekine Member Posts: 12,562
    bangswit wrote:
    in sales line
    i want to disabled this one
    Shipment Date - OnValidate()
    .
    .
    .
    .
    .
    .
      IF "Shipment Date" < WORKDATE THEN
          IF NOT HasBeenShown THEN BEGIN
            MESSAGE(
              Text014,
              FIELDCAPTION("Shipment Date"),"Shipment Date",WORKDATE);
            HasBeenShown := TRUE;
          END;
    .
    .
    .
    .
    .
    .
    .
    .
    
    You need to make clear what you want. In this part you are writing about Shipment Date OnValidate trigger. Now you are writing about validating Item No. Item No. validation trigger is complex and is clearing the line and assigning the values again back. What you really want? Which NAV version?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    bangswitbangswit Member Posts: 265
    actually i want to item in sales line
    using form..... but after it validates item no, it will automatically validate shipment date
    but if i block that code in shipment date... that's what i want
    hope you understand
  • Options
    BeliasBelias Member Posts: 2,998
    in italian version, the same code that outputs the message is like this:
      IF ("Shipment Date" < WORKDATE) AND (Type <> Type::" ") THEN
        IF NOT (HideValidationDialog OR HasBeenShown) AND GUIALLOWED THEN BEGIN
          MESSAGE(
            Text014,
            FIELDCAPTION("Shipment Date"),"Shipment Date",WORKDATE);
          HasBeenShown := TRUE;
        END;
    
    note the HideValidationDialog additional parameter.
    sales line has also another function, called
    SetHideValidationDialog(NewHideValidationDialog : Boolean)
    HideValidationDialog := NewHideValidationDialog;
    
    we can call this function passing TRUE before performing any validation logic, in order to skip every message. Very comfortable, you can replicate the same logic.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    bangswitbangswit Member Posts: 265
    Belias wrote:
    in italian version, the same code that outputs the message is like this:
      IF ("Shipment Date" < WORKDATE) AND (Type <> Type::" ") THEN
        IF NOT (HideValidationDialog OR HasBeenShown) AND GUIALLOWED THEN BEGIN
          MESSAGE(
            Text014,
            FIELDCAPTION("Shipment Date"),"Shipment Date",WORKDATE);
          HasBeenShown := TRUE;
        END;
    
    note the HideValidationDialog additional parameter.
    sales line has also another function, called
    SetHideValidationDialog(NewHideValidationDialog : Boolean)
    HideValidationDialog := NewHideValidationDialog;
    
    we can call this function passing TRUE before performing any validation logic, in order to skip every message. Very comfortable, you can replicate the same logic.

    so we add this code in my report?
    without edit code in table 37?
    i just know in nav 3.7 doesn't have this function
    and i copy it from 2009
  • Options
    BeliasBelias Member Posts: 2,998
    1. create the function sethidevalidationdialog in salesline.
    2. condition the message to the hidevalidationdialog parameter
    3. call the function in your report before validating the fields.
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    bangswitbangswit Member Posts: 265
    Belias wrote:
    1. create the function sethidevalidationdialog in salesline.
    2. condition the message to the hidevalidationdialog parameter
    3. call the function in your report before validating the fields.

    already done that
    but still appear the message box
                                                   SalesLine.SetHideValidationDialog(TRUE);
                                                   SalesLine.VALIDATE(SalesLine."Cross-Reference No.",ItemCode);
    
  • Options
    BeliasBelias Member Posts: 2,998
    debug it!
    there may be another message somewhere else, or you missed something in coding...you know it HAVE TO work!
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    bangswitbangswit Member Posts: 265
    Belias wrote:
    debug it!
    there may be another message somewhere else, or you missed something in coding...you know it HAVE TO work!
    if i change this code
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine.VALIDATE(SalesLine."Cross-Reference No.",ItemCode);
    

    become
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine."Cross-Reference No.":=ItemCode;
    

    it works...
    but not validated
  • Options
    BeliasBelias Member Posts: 2,998
    bangswit wrote:
    Belias wrote:
    debug it!
    there may be another message somewhere else, or you missed something in coding...you know it HAVE TO work!
    if i change this code
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine.VALIDATE(SalesLine."Cross-Reference No.",ItemCode);
    

    become
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine."Cross-Reference No.":=ItemCode;
    

    it works...
    but not validated
    yes, this is true. :|
    but you WANT TO VALIDATE this field, isn't it?
    The solution is so simple that i can't explain it more than this: use debugger, find the additional message and condition it to hidevalidationdialog variable...ok?
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    bangswitbangswit Member Posts: 265
    Belias wrote:
    bangswit wrote:
    Belias wrote:
    debug it!
    there may be another message somewhere else, or you missed something in coding...you know it HAVE TO work!
    if i change this code
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine.VALIDATE(SalesLine."Cross-Reference No.",ItemCode);
    

    become
    SalesLine.SetHideValidationDialog(TRUE);
    SalesLine."Cross-Reference No.":=ItemCode;
    

    it works...
    but not validated
    yes, this is true. :|
    but you WANT TO VALIDATE this field, isn't it?
    The solution is so simple that i can't explain it more than this: use debugger, find the additional message and condition it to hidevalidationdialog variable...ok?

    Ok belias... thanks a lot for your advice :)
  • Options
    bangswitbangswit Member Posts: 265
    function SetHideValidationDialog, only like this ?
    SetHideValidationDialog(NewHideValidationDialog : Boolean)
    HideValidationDialog := NewHideValidationDialog;
    
  • Options
    bangswitbangswit Member Posts: 265
    solved already
    (HideValidationDialog OR HasBeenShown)

    in Shipment Date On validate (Table 37)
    i change the code from
    IF NOT HasBeenShown THEN BEGIN
    become
    IF NOT (HideValidationDialog OR HasBeenShown) AND GUIALLOWED THEN BEGIN

    thanks all
  • Options
    BeliasBelias Member Posts: 2,998
    yes, the function is made by just one line, that sets a global variable to the value you're passing in. but do you understand the code i posted or are you blindly writing the code? :-k
    EDIT: well, it seems you "make it work"...
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    bangswitbangswit Member Posts: 265
    Belias wrote:
    yes, the function is made by just one line, that sets a global variable to the value you're passing in. but do you understand the code i posted or are you blindly writing the code? :-k
    EDIT: well, it seems you "make it work"...
    first i confused
    now i understand
    thanks :thumbsup:
Sign In or Register to comment.