Options

Source Table Name

jetins9810jetins9810 Member Posts: 55
Hi,

How can i get the source table name of a form at run time by coding.


Thanks in advance
With Thanks & Regards
Jetinder Saini...........
CorporateServe Solutions Pvt. Ltd......India

Comments

  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
  • Options
    jetins9810jetins9810 Member Posts: 55
    Thanks for reply

    Dear how can i use this can u explain.

    Thanks in advance
    With Thanks & Regards
    Jetinder Saini...........
    CorporateServe Solutions Pvt. Ltd......India
  • Options
    HalMdyHalMdy Member Posts: 429
    From the online help :
    TABLENAME (Record)
    Use this function to return the name of a C/SIDE table.

    Name := Record.TABLENAME
    Name

    Data type: text or code

    The name of the table.

    Record

    Data type: record

    The record in the table for which you want to find the table name.

    Comments
    The TABLECAPTION function retrieves the Caption property of the table. If you want to enable your application for multilanguage now or in the future, you must use the TABLECAPTION function instead.
  • Options
    jetins9810jetins9810 Member Posts: 55
    Thanks for reply

    Dear i want to pick the SourceTable name of a form at run time.

    Requirement is that at run time i don't know the name of next form
    if i got the form using object table then how can i get the source table
    name of this form.

    Thanks in advance
    With Thanks & Regards
    Jetinder Saini...........
    CorporateServe Solutions Pvt. Ltd......India
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Hi,

    I was affraid you would ask that :(

    It is not possible.

    If it is realy nessesairy to know it this way, a possibility is to create a new table where you save the form id and the sourcetable.

    You have to fill the data in that table yourself. It might be a few hours work.
  • Options
    Michael_SchumacherMichael_Schumacher Member Posts: 81
    Hi Jetins,
    You have a form running and want to know the name of the underlying table?
    If yes then just press Ctrl-F8 for Zoom and in the headline of the zoom you will find the Tablecaption (Tablename in your language)

    I hope that helps :wink:
    regards,
    Michael Schumacher

    oh, what day is it? Backup day. OK, let's dump all data to /dev/nul ;-)
  • Options
    Michael_SchumacherMichael_Schumacher Member Posts: 81
    Jetins, I got this email:
    from Jetins9810
    requirement is that i am creating a report in which i want the list of forms, there
    type and the source table used by these forms. Form name, there ID and there type can be easily found by using object table but how can i print the source table name of these forms in my report.


    Why didn't you post this here, so we don't have to guess what you are trying to do?

    If I knew this before I would never give such a silly answer as I did in my last posting..... :?
    regards,
    Michael Schumacher

    oh, what day is it? Backup day. OK, let's dump all data to /dev/nul ;-)
  • Options
    fbfb Member Posts: 246
    Give this a try...
    PROCEDURE TblIDFromFormID(FormID : Integer) : Integer
    VAR
      Obj : Record 2000000001;
      InStr : InStream;
      NxtInt : Integer;
    BEGIN
      IF Obj.GET(Obj.Type::Form,'',FormID) THEN BEGIN
        Obj.CALCFIELDS("BLOB Reference");
        Obj."BLOB Reference".CREATEINSTREAM(InStr);
        WHILE NOT InStr.EOS DO BEGIN
          InStr.READ(NxtInt);
          IF (NxtInt = 283173) AND (NOT InStr.EOS) THEN BEGIN
            InStr.READ(NxtInt);
            EXIT(NxtInt);
          END;
        END;
      END;
      EXIT(0);  
    END
    
  • Options
    sqagurusqaguru Member Posts: 6
    Hi
    I am also stucked in such situation. I am very much disappointed that many gurus of navision could not resolve my problem.

    Please help me, its very urgent.

    Regards,
  • Options
    jesamjesam Member Posts: 100
    I am very much disappointed that many gurus of navision could not resolve my problem

    One can only play in Navision according to the rules of Navision. If it is not possible, it is simply not possible (I know this might come as a surprise to some commercially minded people).

    Of course, it might be possible through parsing the compiled BLOB like fb posted (haven't tried it) but that is some serious Navision hacking for which one has to know how Navision stores its information internally. Of course, we all know that when we use undocumented features, they are not guaranteed to remain the same or even be available in different releases. That's why they are undocumented.
  • Options
    ajhvdbajhvdb Member Posts: 672
    fb wrote:
    Give this a try

    Lol, what do you do in your spare time...it does work..do you have more info, hints about undocumented options
  • Options
    fbfb Member Posts: 246
    Look through fin.stx for 'SourceTable' and you find the following:

    00082-00037-030-0: SourceTable

    Convert first two numbers to hex:

    82 --> 0x52
    37 --> 0x25

    We could expect that the source table id is stored as a 4-byte integer (e.g., the SourceTable property has a length of 4 --> 0x04). Put these things together, mix in some Intel x86 'back-words' storage nonsense, and you get the following pattern:

    0x25 52 04 00 --> base10 integer 283173: the 'magic number' that the code scans for.

    I imagine the scan could be fooled by a Name and/or CaptionML property containing just the right combination of characters, but hey -- it's just a hack...

    8)
  • Options
    DenSterDenSter Member Posts: 8,304
    Why would you ever need to figure out the sourcetable like that? Navision is a data-driven application, and you typically open a form based on the table. That is why you can enter a lookup form ID, and a drilldown form ID on the table. What use is it to open a form if you don't know what the form is going to show you?

    If this is for development documentation type stuff, then you can export the objects into a text file and look up the values of the SourceTable property opfthe form objects. Or follow fb's advice, he seems to know what he is talking about (chinese to me to tell you the truth :oops: )
Sign In or Register to comment.