Yes, the sample codeunit is merely a copy (with some empty additional functions) of the localized standard NAV 4.0 (SP1) Codeunit 11501 (VersionList=NAVDACH4.00.01).
There is another (earlier) version of this codeunit in NAV 4.0 (VersionList=NAVDACH4.00) which is much more transparent and easier to extend, since it uses integer codes instead of letter symbols:
OBJECT Codeunit 11501 GeneralMgt
{
OBJECT-PROPERTIES
{
Date=23.09.04;
Time=12:00:00;
Version List=NAVDACH4.00;
}
PROPERTIES
{
OnRun=BEGIN
END;
}
CODE
{
VAR
Text001@1150000 : TextConst 'DEU=Der Ordnername muss auf einen Schr„gstrich enden, d. h. %1.;ENU=The folder name must end with a slash character, i.e. %1.';
PROCEDURE CheckFolderName@2(VAR _Input@1150000 : Text[250]) _Output@1150001 : Text[250];
BEGIN
// Check for ending slash of folder name
IF _Input = '' THEN
EXIT;
IF NOT (COPYSTR(_Input,STRLEN(_Input)) IN ['\','/']) THEN
MESSAGE(Text001,'c:\data\');
END;
PROCEDURE Ansi2Ascii@10(_String@1150001 : Text[250]) _Output@1150000 : Text[250];
VAR
i@1150003 : Integer;
Z@1150002 : Char;
BEGIN
// Converts from ANSI to ASCII
FOR i := 1 TO STRLEN(_String) DO BEGIN
Z := _String[i];
CASE Z OF
// Convert special chars in ASCII
228: Z := 132; // „ ANSI=Alt0228, ASCII=Alt132
196: Z := 142; // Ž
226: Z := 131; // ƒ
224: Z := 133; // …
225: Z := 160; //
229: Z := 134; // †
197: Z := 143; //
230: Z := 145; // ‘
198: Z := 146; // ’
199: Z := 128; // €
231: Z := 135; // ‡
233: Z := 130; // ‚
234: Z := 136; // ˆ
235: Z := 137; // ‰
232: Z := 138; // Š
201: Z := 144; //
239: Z := 139; // ‹
238: Z := 140; // Œ
236: Z := 141; //
237: Z := 161; // ¡
246: Z := 148; // ”
214: Z := 153; // ™
244: Z := 147; // “
242: Z := 149; // •
243: Z := 162; // ¢
252: Z := 129; //
220: Z := 154; // š
251: Z := 150; // –
249: Z := 151; // —
250: Z := 163; // £
241: Z := 164; // ¤
165: Z := 209; // ¥
255: Z := 152; // ˜
163: Z := 156; // œ
248: Z := 157; // ›
END;
_String[i] := Z;
END;
EXIT(_String);
END;
PROCEDURE Ascii2Ansi@1150001(_String@1150001 : Text[1024]) @1150000 : Text[1024];
VAR
NoProcessed@1150002 : Integer;
i@1150003 : Integer;
Z@1150004 : Char;
BEGIN
// Converts from ASCII to ANSI
FOR i := 1 TO STRLEN(_String) DO BEGIN
Z := _String[i];
CASE Z OF
// Convert special chars in ANSI
132: Z := 228; // „ ASCII=Alt132, ANSI = Alt0228
142: Z := 196; // Ž
131: Z := 226; // ƒ
133: Z := 224; // …
160: Z := 225; //
134: Z := 229; // †
143: Z := 197; //
145: Z := 230; // ‘
146: Z := 198; // ’
128: Z := 199; // €
135: Z := 231; // ‡
130: Z := 233; // ‚
136: Z := 234; // ˆ
137: Z := 235; // ‰
138: Z := 232; // Š
144: Z := 201; //
139: Z := 239; // ‹
140: Z := 238; // Œ
141: Z := 236; //
161: Z := 237; // ¡
148: Z := 246; // ”
153: Z := 214; // ™
147: Z := 244; // “
149: Z := 242; // •
162: Z := 243; // ¢
129: Z := 252; //
154: Z := 220; // š
150: Z := 251; // –
151: Z := 249; // —
163: Z := 250; // £
164: Z := 241; // ¤
165: Z := 209; // ¥
152: Z := 255; // ˜
156: Z := 163; // œ
157: Z := 248; // ›
END;
_String[i] := Z;
END;
EXIT(_String);
END;
BEGIN
END.
}
}
Note, that the letter signs (in the comments) are displayed correctly, if you import the object (may be with different object ID) into NAV.
Comments
Bart van Beek
Boltrics Professionals B.V. | www.boltrics.nl
Nekovri Dynamics | 3PL Dynamics
Ps.
How can you add your own characters. Is there a howto?
RIS Plus, LLC
There is another (earlier) version of this codeunit in NAV 4.0 (VersionList=NAVDACH4.00) which is much more transparent and easier to extend, since it uses integer codes instead of letter symbols: Note, that the letter signs (in the comments) are displayed correctly, if you import the object (may be with different object ID) into NAV.