Can I read all fieldcaptions directly?

SunsetSunset Member Posts: 201
I need to get all caption values of the fields in various tables. Is there any way to code this?

I know I can do it by setting the language and then running a report/dataport exporting fieldcaption. But I was wondering if it might be possible to export all languages in one go.

Something like
FieldRec.SETRANGE(TableNo, 36);
RecordRef.OPEN(36);
FieldRec.FINDSET;
repeat
  FieldRef := RecordRef.FIELD(FieldRec."No.")
  //Start language loop
    Export FieldRef.CAPTION;
  //End language loop
until FieldRec.NEXT = 0;

Or if I can read the CaptionML directly somewhere, that would be equally helpful.

Tools-> Translate -> Export will also almost do what I need. But then I need to make some code to run through the file stripping the extra identification values for each line.
Don't just take my word for it, test it yourself

Answers

  • jglathejglathe Member Posts: 639
    Hi sunset,

    doesn't seem to work - only export as .txt or xml would contain all the CaptionML strings.

    with best regards

    Jens
  • MBergerMBerger Member Posts: 413
    You could use the Language function in your report, but you'd need to know all the languages you have, and look up their Windows language ID's. It's all in the helpfile though.
  • RickrisRickris Member Posts: 21
    hmmm, i have in mind that maybe you can use the field virtual table with combination of sendkeys.

    read the table field caption that you need then use send keys to change the language under Tools -> Language.
    NAV Developer since 2006
  • SogSog Member Posts: 1,023
    No need for sendkeys.
    From help on globallanguage function.

    (See code, F5, system, language)

    GLOBALLANGUAGE (Language)
    Use this function to set and retrieve the current C/SIDE global language setting.

    so filter your language table to the supported languages in your system, loop over them, and use the globallanguage function to change the language just before you export the caption.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • SunsetSunset Member Posts: 201
    Globallanguage did the trick. Thank you =D>
    Don't just take my word for it, test it yourself
Sign In or Register to comment.