Validation in a report

Sapphire123
Sapphire123 Member Posts: 112
Hi All,

In my processing report, I would like to capture errors when I'm validating field, e.g. recSalesHeader.validate("Sell-to-customer", theCustName)... if 'theCustName'does not exist, I would like to capture the error message, instead of having a pop up message displayed to hte user - how do I do this?

Any suggestions?
Thanks in advance!

Comments

  • djswim
    djswim Member Posts: 277
    edited 2008-09-16
    ---FAIL! Deleted because I misread the question---
    "OMG ALL MY DATA IS GONE"
    "Show All..."
    "Oh..."
  • DenSter
    DenSter Member Posts: 8,307
    The only thing you could do is to test for the error situations first and report on those, but that would take a LOT of programming.
  • djswim
    djswim Member Posts: 277
    ---FAIL! Deleted because I misread the question---
    "OMG ALL MY DATA IS GONE"
    "Show All..."
    "Oh..."
  • cunny
    cunny Member Posts: 129
    Hi there,

    You could probably do something like this:

    1) create a function called IfItemExists(ItemNo)
    If Item.Get(ItemNo) then exit(true)
    else exit(false)

    2) If IfItemExists(ItemNo) then
    recSalesHeader.validate("Sell-to-customer", theCustName) else
    ...//record the missing item somewhere in a text file or another table

    Regards,
    cunny Lee
    MCP - MBS Navision
    jle@naviworld.com
  • Sunset
    Sunset Member Posts: 201
    If you are runnning NAV5 you can use GETLASTERRORTEXT

    Have a codeunit call the report. If the codeunit returns true, the report is ok, if it returns false you can catch errorstring.
    Don't just take my word for it, test it yourself