Find calling function inside all navision code

GabryGabry Member Posts: 48
edited 2013-07-12 in NAV Three Tier
I need to check where are the calls to a specific function that is present in a codeunit that is part of an add-on. In other words I have the function called "FunctionToBeFound" and I need to know where it is called in all NAV code inside a database (code in tables, forms, codeunits and so forth). Taking into account that it is a function part of an add-on, I am expected that it is not present in the standard code, but it is not enough.

Is there a specific functionality in NAV that finds a string in a massive/mass mode in an acceptable time? Or any other way?

Comments

  • lvanvugtlvanvugt Member Posts: 774
    Gabry wrote:
    Is there a specific functionality in NAV that finds a string in a massive/mass mode in an acceptable time?
    No, but have a look here: Statical Prism.
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • pdjpdj Member Posts: 643
    Object Manager has a great WhereUsed funtionality and many other useful functions.
    I think there used to be a free light version, but I guess that is gone now.
    Give the Advanced edition a try with the free time-limited trail: http://www.mibuso.com/dlinfo.asp?FileID=826
    Regards
    Peter
  • rmv_RUrmv_RU Member Posts: 119
    If you have licence permission:
    1. Add new parameter into the function and save a codeunit.
    2. Goto a Object Designer and compile a project.
    Looking for part-time work.
    Nav, T-SQL.
  • GabryGabry Member Posts: 48
    rmv_RU wrote:
    If you have licence permission:
    1. Add new parameter into the function and save a codeunit.
    2. Goto a Object Designer and compile a project.

    Thank you for your post. The problem is that I should check all the NAV objects where there is code (tables, forms, codeunits...): there too many objects to compile. Is it possible to compile all the objects in NAV together in a short way?
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Then this approach might work:

    1. Rename your function to something unique: FunctionToBeFoundXYZ123
    2. Export all NAV objects as text
    3. Load this textfile in your texteditor (not notepad) and search for the text 'FunctionToBeFoundXYZ123'

    Don't forget to rename your function back to the original name afterwards.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • pdjpdj Member Posts: 643
    Gabry wrote:
    The problem is that I should check all the NAV objects where there is code (tables, forms, codeunits...): there too many objects to compile. Is it possible to compile all the objects in NAV together in a short way?
    Yes, but be aware that compiling objects isn't a 100% safe action.

    First of all you thereby delete the stored settings in all users ZUP files. If done in a Live enviroment, you get a lot of angry users :-)
    If you do it in a Dev enviroment, you might overwrite work of other developers, if you have old objects in your object cache.
    And finally. If you are missing any nessesary components used by any of the objects, then the object are left in an error-state (at least in NAV2013, don't remember in NAV2009).

    I'm not saying it isn't a simple solution - just be carefull...
    Regards
    Peter
  • GabryGabry Member Posts: 48
    pdj wrote:
    Gabry wrote:
    The problem is that I should check all the NAV objects where there is code (tables, forms, codeunits...): there too many objects to compile. Is it possible to compile all the objects in NAV together in a short way?
    Yes, but be aware that compiling objects isn't a 100% safe action.

    First of all you thereby delete the stored settings in all users ZUP files. If done in a Live enviroment, you get a lot of angry users :-)
    If you do it in a Dev enviroment, you might overwrite work of other developers, if you have old objects in your object cache.
    And finally. If you are missing any nessesary components used by any of the objects, then the object are left in an error-state (at least in NAV2013, don't remember in NAV2009).

    I'm not saying it isn't a simple solution - just be carefull...

    I did understand that I should be careful, but the problem misses because I have to manage a local and personal NAV database. The issue is another: how do I compile all the objects in a massive/mass way? Is there a specific functionality? I cannot compile thousand amd thousand of objects in entire NAV application becasue is too much time consuming. I hope that I explianed better my point.
  • pdjpdj Member Posts: 643
    Alt-a, Ctrl-a, F11, Y
    Then go get a cup of coffee and when you come back all object with problems are either marked or in an error list (depending on which version you use). Copy the objects with errors to a spreadsheet, as you easily loose the list in NAV.
    Regards
    Peter
  • GabryGabry Member Posts: 48
    Then this approach might work:

    1. Rename your function to something unique: FunctionToBeFoundXYZ123
    2. Export all NAV objects as text
    3. Load this textfile in your texteditor (not notepad) and search for the text 'FunctionToBeFoundXYZ123'

    Don't forget to rename your function back to the original name afterwards.

    I tried to export all the objects as you suggested me, but Nav did not make it due to the following error message "Tabledata 55100 do not exist". I found an object with this number and this name, but I did not find it. Do you understand this erroe message?
  • GabryGabry Member Posts: 48
    pdj wrote:
    Alt-a, Ctrl-a, F11, Y
    Then go get a cup of coffee and when you come back all object with problems are either marked or in an error list (depending on which version you use). Copy the objects with errors to a spreadsheet, as you easily loose the list in NAV.

    in Italy we are happy to have a coffee, but...

    (1) Does it work using NAV version 2009 R2?
    (2) there are about 40 functions that I should rename in a specific codeunit (part of an add-on): the entire issue is to be sure that all the functions inside this codeunit are not called from any other object in all NAV. Should I just check where the codeunit "CodeUnitToFind" is present in the exported text file? Of course I can rename it.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Gabry wrote:
    Do you understand this erroe message?
    Yes, I understand this error.

    Somewhere, there is an object which references table 55100, but that table does not exists. It's probably a form based on that missing table.

    To find out which form it is you can compile all forms. If you don't want to do that, than export the first half of all form objects as text (eg. forms 1 ... 50000). If there is no error during export, then try exporting the 2nd half of all form objects (eg. forms 50001 ... 999999999999) . If there is an error, then export the first half of this 2nd half of objects (eg. 50001 ... 70000) etc.

    If you don't want to do this, send me the database and 500 EUR and I'll find the object for you.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • GabryGabry Member Posts: 48
    Gabry wrote:
    pdj wrote:
    Alt-a, Ctrl-a, F11, Y
    Then go get a cup of coffee and when you come back all object with problems are either marked or in an error list (depending on which version you use). Copy the objects with errors to a spreadsheet, as you easily loose the list in NAV.

    in Italy we are happy to have a coffee, but...

    (1) Does it work using NAV version 2009 R2?
    (2) there are about 40 functions that I should rename in a specific codeunit (part of an add-on): the entire issue is to be sure that all the functions inside this codeunit are not called from any other object in all NAV. Should I just check where the codeunit "CodeUnitToFind" is present in the exported text file? Of course I can rename it.

    Dear pdj,

    I tried to compile all the objects as you suggest me but the problem is that there are too many objects that are not possible to compile (F11 key). For instance also the specific codeunit (part of an add-on) where there are all the functions that I want to avoid shows the following error if I compile it: "Could not load the selected type library". The paradox is that al least 4 functions inside this codeunit work in production environment. Do you have any insights to go on focusing on my goal?
  • GabryGabry Member Posts: 48
    For instance also the specific codeunit (part of an add-on) where there are all the functions that I want to avoid shows the following error if I compile it: "Could not load the selected type library".

    I found this compuile error: there is a variable that is "automation" type that has not the subtype. Unfortunately this point does not solve my issue.
  • pdjpdj Member Posts: 643
    It is not a paradox. When the objects are compiled, then they can be used. If a specific function in the object is using a component, then it will fail unless the user has the component. Users without the component can only use functions in the object, as long as the functions doesn't try to use the component.

    You have a poorly maintained database, when you have objects refering to non-existing tables and maybe even other NAV objects. So do most companies - developers are lazy (and proud of it :wink:). Now would be a good time to get these kinds of problems fixed.

    So far you have been given 4 different suggestions:

    1) Object Manager
    2) Statical Prism (never tried this one, but it seems to be able to do the job as well)
    3) Export in Txt format
    4) Compile al objects

    All of them does the job - you just need to work around the limitations when you have partly invalid objects.
    Regards
    Peter
  • GabryGabry Member Posts: 48
    pdj wrote:
    So far you have been given 4 different suggestions:

    1) Object Manager
    2) Statical Prism (never tried this one, but it seems to be able to do the job as well)
    3) Export in Txt format
    4) Compile al objects

    All of them does the job - you just need to work around the limitations when you have partly invalid objects.

    I used 4th suggestion: I exported the critical codeunit, I saved it, afterwards I deleted it and finally I compile all the objects: I found the list of objects that defines that codeunit. Thank you.

    As far as I understood and tried, it is not possible to export txt format if all the objects are not compiled.
Sign In or Register to comment.