Mibuso Conference

29 10 2008

Networking event celebrating (10 years of mibuso.com)
Meet people in real life on 14 May 2009 in Utopolis Mechelen (Belgium)



Navision Internal Error x in module y

14 07 2008

The following error messages can be found in Navision Financials, Navision Attain, Navision Solutions, Microsoft Business Solutions Navision, and Dynamics NAV. The error message is generally just a number, this table can be used to find out a little bit more about the error.

See the whole list of error messages:

View Site



Copy an error message

10 07 2008

Did you know that you can copy an error message?

Copy Error

  • Select the error message
  • Send: CTRL + C
  • Open notepad
  • Send CTRL + V

You see:
—————————
Microsoft Dynamics NAV
—————————
Item No. ” does not exist.
—————————
OK
—————————



Delete Double Spaces

8 07 2008

By exporting or importing data you want to get clean data.

For example:
This   line     will      be        imported
This line will be imported

Use this function in your dataport to delete all double spaces in a string:

gFncDeleteDoubleSpaces(lTxtString : Text[1024]) : Text[1024]
IF DELCHR(lTxtString,'=',' ') = '' THEN
  EXIT('');
REPEAT
  i += 1;
  lTxtChar := COPYSTR(lTxtString,i,1);
  IF lTxtChar <> ' ' THEN BEGIN
    lTxtNewString += lTxtChar;
    IF NOT lBlnAddSpace THEN
      lBlnAddSpace := TRUE;
  END ELSE
    IF lBlnAddSpace THEN BEGIN
      lTxtNewString += ' ';
      lBlnAddSpace := FALSE;
    END;
UNTIL i = STRLEN(lTxtString);
EXIT(lTxtNewString);

Define the follow variable:

lTxtNewString as Text(1024)
i as Integer
lTxtChar as Text(1)
lBlnAddSpace asBoolean �



Dataport Bug

8 07 2008

What’s the bug:

- Create a new dataport.
- Select View > Dataport Fields.
- Click on Field Menu button (see 1)
- Select the fields you want to export.
- Here’s the bug (see 2), you cannot press OK / Cancel or Apply.

But how do you get the dataport fields???

After selecting the fields click with your cursor in the Field Designer Form (see 3)

Dataport Bug



Progress Bar Estimated time left

24 06 2008

Have you ever started a lengthy NAV batch job, and then wondered how much longer it is really going to take? NAV forms usually have progress bars. Good. But how about something like this:

Estimated Time Left
Read the rest of this entry »



Security Issue

21 06 2008

Each company (I hope) creates every day or week a backup of the database.
Because when the database crashes, there is a backup.

O no, I forgot my SUPER user password!

No problem, restore your backup and after restore do not close the database because you are in the database.
Yes, without username and without a password!

Thanks Bill!



How to solve an Automation Error

21 06 2008

When getting the following error (for example):

AError

(Click on image to enlarge)

This problem arises as result of a not registered dll of the Automation. But which dll?

Follow next steps to found and register the Automation dll:

  1. Open the Object Designer
  2. Create a new Tabular-Type Form with Table: Automation
  3. Add all fields on the form
  4. Press preview
  5. Filter on the GUID collumn with the value in the error message
    (this example: {9A2E02D5-9163-46AA-8D07-EE72842AC205}
  6. In the collumn TypeLibFile you see a dll
  7. Register this dll (You can download the Dll Register)

After the dll registration the problem has gone!



RecordRef, Fieldref and KeyRef example

17 06 2008

Define the following variabels

  • RecRef as RecordRef
  • FldRef as FieldRef
  • RecReftmp as RecordRef
  • FldReftmp as FieldRef
  • KeyRef as KeyRef
  • KeyFldRef as FieldRef
  • i as Integer
  • x as Integer
  • BestKeyIndex as Integer

Define the following function: GetBestKey()

RecRef.OPEN(27,FALSE,'Company Name');   //Open table 27 - Item
FldRef := RecRef.FIELD(3);              //Get field 3 - Description
GetBestKey();                           //Get the best key to decrease performance issues
IF BestKeyIndex > 0 THEN
  RecRef.CURRENTKEYINDEX(BestKeyIndex); //Set the best key if exists
FldRef.SETFILTER('*@as*');              //Filter on description
IF RecRef.FIND('-') THEN BEGIN
  REPEAT
    RecReftmp.OPEN(27,TRUE);            //\
    FldReftmp := RecReftmp.FIELD(3);    // \
    RecReftmp.INIT;                     //  Empty description
    FldRef.VALUE := FldReftmp.VALUE;    // /
    RecRef.MODIFY;                      ///
  UNTIL RecRef.NEXT = 0;
END;
//Function GetBestKey() code
FOR i := 1 TO RecRef.KEYCOUNT DO BEGIN
  KeyRfr := RecRef.KEYINDEX(i);
  FOR x := 1 TO KeyRfr.FIELDCOUNT DO BEGIN
    KeyFldRef := KeyRfr.FIELDINDEX(x);
    IF FldRef.NUMBER = KeyFldRef.NUMBER THEN BEGIN
      BestKeyIndex := i;
      EXIT;
    END;
  END;
END;


Auto Delete Report/Dataport After Run

17 06 2008

You can use this code in de OnPostDataItem trigger function.

It’s usefull for Correction Report / Dataports.

Object.SETRANGE(Type,Object.Type::Report);
Object.SETFILTER(ID,DELSTR(CurrReport/CurrDataport.OBJECTID(FALSE),1,7));
IF Object.FIND('-') THEN
  Object.DELETE;


Program a lookup

17 06 2008

Sometimes you want to have a lookup on a dataport or report option tab.
Here my solution to program the lookup:

Define 2 Variabels in the OnLookUp trigger:
 - FORM = The form that will be shown. (Type = Form)
 - RECORD = The record variable of the FORM that will started. (Type = Record)

CLEAR(FORM);
FORM.SETTABLEVIEW(RECORD);
FORM.LOOKUPMODE(TRUE);
IF FORM.RUNMODAL = ACTION::LookupOK THEN BEGIN
  FORM.GETRECORD(RECORD);
  Rec.FIELD := RECORD.FIELD
  MODIFY;
END;


How to write data to a text file

16 06 2008

If you’ve got a problem in a time consuming process and the debugger is not usefull enough.
You can use this code to write each value to a text file, wherever you want:

Define gFillTemp as File 

gFillTemp.TEXTMODE(TRUE);
gFillTemp.WRITEMODE(TRUE);
IF NOT gFillTemp.OPEN('filename.txt') THEN
  gFillTemp.CREATE('C:\filename.txt');
gFillTemp.SEEK(gFillTemp.LEN);
gFillTemp.WRITE('text to write');  //Write text
gFillTemp.WRITE(gRecitem);         //Write record
gFillTemp.CLOSE;


Run any program from Navision

16 06 2008

Start any program from navision:

For example:

SHELL('access.cpl')

[code] = run Accessibility Controls

Accessibility Wizard - accwiz
Add Hardware Wizard - hdwwiz.cpl
Add/Remove Programs - appwiz.cpl
Administrative Tools - control admintools
Automatic Updates - wuaucpl.cpl
Bluetooth Transfer Wizard - fsquirt
Calculator - calc
Read the rest of this entry »



HotCopy Layout

16 06 2008

hotcopy
source=C:\test.fdb
destination=C:\backup
description=”Text”
email=test@test.com
servername=ServerName
username=User password=Password | osauthentication=yes
dbtest=normal
cc=yes
nttype=tcp



How to program a Progress Bar

16 06 2008

Define these Globale:

  • gDlgWindow as Dialog
  • gIntNoOfRecords as Integer
  • gIntRowCounter as Integer
  • gTimNextUpdate asTime

            Define these Text Constants:

  • Text001 with text: Processing records:\
  • Text002 with text: Number: ##########1#\
  • Text003 with text: @@@@@@@@@@@@2@\
gDlgWindow.OPEN(Text001 + Text002 + Text003);
gIntNoOfRecords :=  Rec.COUNT;
gIntRowCounter +=1;
IF TIME > gTimNextUpdate THEN BEGIN
  gDlgWindow.UPDATE(1,Rec.Field);
  gDlgWindow.UPDATE(2,ROUND(gIntRowCounter / gIntNoOfRecords * 10000,1));
  gTimNextUpdate := TIME + 200
END;
gDlgWindow.CLOSE