Some time back we ran across a Danish Solution Center that had a free form text box that populated the Navision Comments table. Does anyone know who that is? The goal here is to allow for continuous typing in a comment box with word wrap and without having to be conscious of the length of the text. Any other options will be welcomed! P.S. Why do we call them Add-Ons when they are really Add-Ins? Wouldn’t it be better to point out the difference to the marketplace with that terminology? [8D]
Based on Erik’s report, this will be a standard feature in Navision 4.0
Thanks Alex. I need a solution now and USv4.0 isn’t due out until December. The client is in v3.6 at this time.
This code will edit/insert the content of a blob field using Notepad: recordvar.CALCFIELDS(Note); FileName := ENVIRON('Temp') + '\' + FORMAT(recordvar."Linienr.") + '_' + recordvar.Nummer + '_' + recordvar."Bilagsnr." + '.txt'; CmdLine := 'notepad ' + FileName; IF EXISTS(FileName) THEN IF ERASE(FileName) THEN ; IF recordvar.Note.HASVALUE THEN BEGIN IF recordvar.Note.EXPORT(FileName,FALSE) = FileName THEN FileOK := TRUE; END ELSE BEGIN OutFile.WRITEMODE(TRUE); OutFile.TEXTMODE(TRUE); OutFile.QUERYREPLACE(FALSE); IF OutFile.CREATE(FileName) THEN BEGIN OutFile.CLOSE; FileOK := TRUE; END; END; IF FileOK THEN BEGIN ReturnValue := SHELL(CmdLine); IF recordvar.Note.IMPORT(FileName,FALSE) = FileName THEN recordvar.MODIFY(TRUE); IF EXISTS(FileName) THEN IF ERASE(FileName) THEN ; END;
This code will insert the text from a blob field to the lines. This was done in version 2.60 and has not been updated since. Therefore not using streams… Parameter: Var SalgLinie Record Salgslinie Locals: TempSTDTekster Record STDTekster TempSTDTekster2 Record STDTekster TempFile File FileName Text 250 IncommingText Char CharCounter Integer CharTotal Integer Comment Text 50 CR Char LF Char TAB Char SPACE Char LineNo Integer TabSize Integer TilSalgLinie Record Salgslinie SalgHoved Record Salgshoved LinieAfstand Integer NæsteLinieNr Integer
CLEAR(LineNo); CLEAR(CharCounter); CLEAR(CharTotal); FileName := ENVIRON('temp') + '\temp.txt'; CR := 13; LF := 10; TAB := 9; SPACE := 32; LineNo := 1; //TabSize := 3; //Not implemented YET IF EXISTS(FileName) THEN IF ERASE(FileName) THEN ; SalgLinie.CALCFIELDS(Note); IF SalgLinie.Note.HASVALUE THEN BEGIN SalgLinie.Note.EXPORT(FileName,FALSE); TempSTDTekster.INIT; TempSTDTekster.LøbeNr := 1; TempSTDTekster.INSERT(FALSE); TempFile.TEXTMODE := FALSE; TempFile.OPEN(FileName); IF TempFile.LEN > 0 THEN REPEAT CharCounter += 1; //Counter per line CharTotal += 1; //Counter for all lines TempFile.READ(IncommingText); //Read one char at a time from the tempfile. CASE IncommingText OF CR : // Start a new line and skip this char. BEGIN LineNo += 1; TempSTDTekster2 := TempSTDTekster; TempSTDTekster2.INSERT(FALSE); TempSTDTekster.INIT; TempSTDTekster.LøbeNr := LineNo; TempSTDTekster.INSERT(FALSE); CharCounter := 0; END; LF : ; //MUST be empty, LF is always following a CR. Then the rest is skipped. ELSE BEGIN IF (CharCounter > 50) THEN BEGIN LineNo += 1; TempSTDTekster2 := TempSTDTekster; TempSTDTekster2.INSERT(FALSE); TempSTDTekster.INIT; TempSTDTekster.LøbeNr := LineNo; TempSTDTekster.INSERT(FALSE); CharCounter := 1; END; CASE IncommingText OF TAB : IncommingText := SPACE; END; IF (CharCounter = 1) AND (LineNo > 1) THEN //Cut previous line after the last space character. IF STRPOS(TempSTDTekster2.Tekst,' ') <> 0 THEN WHILE COPYSTR(TempSTDTekster2.Tekst, STRLEN(TempSTDTekster2.Tekst), 1) <> ' ' DO BEGIN //Copy characters from the end of previous line to current line. TempSTDTekster.Tekst := COPYSTR(TempSTDTekster2.Tekst, STRLEN(TempSTDTekster2.Tekst), 1) + TempSTDTekster.Tekst; TempSTDTekster.MODIFY(FALSE); //Delete the character just copied from the previous line. TempSTDTekster2.Tekst := DELSTR(TempSTDTekster2.Tekst, STRLEN(TempSTDTekster2.Tekst), 1); TempSTDTekster2.MODIFY(FALSE); //Increase counter of current line for each character copied. CharCounter += 1; END; //This is where the TempSTDTekster.Tekst := TempSTDTekster.Tekst + FORMAT(IncommingText); TempSTDTekster.MODIFY(FALSE); END; END; UNTIL TempFile.POS = TempFile.LEN; TempFile.CLOSE; ERASE(FileName); IF TempSTDTekster2.FIND('-') THEN BEGIN REPEAT TempSTDTekster := TempSTDTekster2; TempSTDTekster.MODIFY(FALSE); UNTIL TempSTDTekster2.NEXT = 0; END; TilSalgLinie.RESET; TilSalgLinie.SETRANGE(Bilagstype,SalgLinie.Bilagstype); TilSalgLinie.SETRANGE("Bilagsnr.",SalgLinie."Bilagsnr."); TilSalgLinie := SalgLinie; IF TilSalgLinie.FIND('>') THEN BEGIN LinieAfstand := (TilSalgLinie."Linienr." - SalgLinie."Linienr.") DIV (1 + LineNo); IF LinieAfstand = 0 THEN ERROR('Der er ikke plads til at indsætte tekster.'); END ELSE LinieAfstand := 10000; NæsteLinieNr := SalgLinie."Linienr." + LinieAfstand; IF TempSTDTekster.FIND('-') THEN BEGIN REPEAT TilSalgLinie.INIT; TilSalgLinie.Bilagstype := SalgLinie.Bilagstype; TilSalgLinie."Bilagsnr." := SalgLinie."Bilagsnr."; TilSalgLinie."Linienr." := NæsteLinieNr; NæsteLinieNr := NæsteLinieNr + LinieAfstand; TilSalgLinie.Beskrivelse := Ansi2Ascii(TempSTDTekster.Tekst); TilSalgLinie."Tilknyttet linienr." := SalgLinie."Linienr."; IF SalgLinie.Bilagstype = SalgLinie.Bilagstype::Tilbud THEN TilSalgLinie.TextType := TilSalgLinie.TextType::SalgsTekst; IF SalgLinie.Bilagstype = SalgLinie.Bilagstype::Ordre THEN TilSalgLinie.TextType := TilSalgLinie.TextType::ProduktionsTekst; TilSalgLinie.INSERT; UNTIL TempSTDTekster.NEXT = 0; END; END;
for a very simple solution with no blobs, just the good old comment window, you might want to use the first solution of this thread: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=8897