-
Checking if a RecordRef or FieldRef variable is initialized
If you need to do this, the best way that I have found is as follows: IF FORMAT(MyRecordRef) <> '' THENBEGIN ... ...END; I consider it to be a little dirty, but it's simple and it works. The problem is, if there is a constant to do the check I don't know what it is, and you cannot create a checking variable and leave it…
-
Company-Initialize (Codeunit 2)
May be worth mentioning in the Tips&Tricks section. When doing custom development, never forget to update Codeunit 2 (Company-Initialize). What do you do with it: everything that has to be done when users create a new company (duh...): - Initialize Setup Tables - Insert default records/values (usually in setup tables) -…
-
Generating reports into Excel at night
Sometimes no matter what you do, the slowness of a report due to too much transactions or a complicated request makes it hard to use. So why not autogenerate reports at night into Excel? Here is an example inventory list - one for each Location on a separate Worksheet. {NOTES: sum won't work with any other language than…
-
The (n)th day of (Month), (Year)
The (n)th day of (Month), (Year). I needed to show the date in this format for a report. VariablestxtDay Text(30)txtMonthYear Text(30)txtDay := FORMAT(TODAY,0,'<Day>');txtMonthYear := FORMAT(TODAY,0,'<Month Text>, <Year4>');CASE txtDay OF '1','21','31' : txtDay := STRSUBSTNO('%1st',txtDay); '2','22' : txtDay :=…
-
Simple way to store lots of boolean data
As an idea that occured to me in this topic: http://www.mibuso.com/forum/viewtopic.php?t=13671 If you have lots of boolean, yes/no information, you don't need to create a field for each of them, you can also store them all in one integer, by borrowing the idea from Unix security. For example, you have information that…
-
Dateformular addition
Hello It's been a while since I've used dateformular fields. You can't just add them. So far I've basically done this. Convert it to string and concatenate it. evaluate(DateFormularA,format(DateFormularB) + '+' + format(DateFormularC)); So DateFormularB := 2D; DateFormularC := 2D; then DateFormularA := 2D + 2D; And it…
-
SHELL Command and Notepad.exe
I had trouble executing the Notepad.exe from Navision 4.0 and read some fine alternatives in this forum how to solve the issue about Navision 4.0 not containing the path to notepad.exe which doesent want to run without the full path. I have solved the problem a little different, and here are the examples: From C/SIDE…
-
Easy upgrading/merging of NAV developments
I think many of you know this, but maybe somebody does not, so: If you open two Navision databases (one local, one server f.e. you cannot open two local ones without installing a second client), then copy-paste works very sophisticatedly: copy-pasting a button, menu item, or a function in the View/Locals/Functiobs carries…
-
Navision 4.0 Training Videos
Several Navision 4.0 videos on different topics made available for public viewing : http://www.projectstreamer.com/users/rbaxter/
-
Error introduced in Navision 4.0 SP1
Hi there, This is rather warning than tip but... Anyway - with Navision 4.0 SP1 there were introduced an error in codeunit 22. There are two lines removed from function InitValueEntry: ValueEntry."Posting Date" := "Posting Date"; // <- this is left in code ValueEntry."Source Doc. Type" := "Source Doc. Type"; // <- this has…
-
Form 634 in NAV 4.x
Did you notice form 634 available in NAV 4.x? OK, so try this: Add this function to form 634 (GLAcc is a G/L Account record):ExpandAccNo(cNo : Code[20])TempGLAcc.RESET;TempGLAcc.DELETEALL;TempGLAcc.SETCURRENTKEY("No.");GLAcc.SETFILTER("Account Type",'<>%1',GLAcc."Account Type"::"End-Total");IF GLAcc.FIND('-') THEN REPEAT…
-
Breaking Loops
You can break a loop by placing the loop in its own function and using an EXIT statement within the loop.
-
Rename/create/delete fields and objects
If you want to rename a field (or a object), run a form on table 2000000041:"Field" (or table 2000000001:"Object"). Change the name in that table, leave the record and check the field (or object) in the object designer. It will your new name. It is also possible to create/delete fields with this! And also delete objects…
-
FreeTutorial 2 - Zipcode and Postcode using Navision and AFD
Hi Guys I have just uploaded my second learning tutorial, on my website, this is of course free to download and has the object files, for PostCode and ZipCode examples. There is a link to AFD where you can download the evaluation software required, which like Navision is data restricted, but is ideal for testing. This link…
-
File Correction
The problem : A file contains " ; \ and some other characters difficult to import in Navision. Those charcater are insides fields (for instance in Customer Address). How to import those files ? Solution : Correct the file before import The code bellow open the file to correct, replace Chars and create a new file. This…
-
An alternative to OCX controls for Navision
There are some wonderful OCX-es in the downloads section, I really like them. But the problem is that they are hard to write and even harder to customize - if you have to change it, have to compile them and install them again on all client machines. It's not really Navision-like - what we really need is an easy and…
-
Test for bit set in integer value
Do you need to know if some bit is set in some integer value ? I didn't manage to find simple binary AND operator, so had to write this test in a little more complicated way :) testForBit(BitNo : Integer;Value : Integer) : Boolean // test if bit BitNo is set in word Value IF (BitNo >=0) AND (BitNo < 32) THEN EXIT(…
-
Limiting database reads when processing lots of records
E.g. you are scanning T32:"Item Ledger Entry" and for each record, you read the T27:"Item"-table. So the number of reads you do on the database is double the number of "Item Ledger Entry"-records. This can be limited a lot. GetItem(IcodItemNo : Code[20];VAR OrecItem : Record Item)// GetItem// Gets the item in "tmpItem"//…
-
Microsoft Office constants value
If you are using some Automations for Microsoft Excel you can need to use some constants. In Microsoft help there are only the names of the values, but you need the numbers in Navision. There is the resource for you: http://msdn.microsoft.com/library/defau ... 049962.asp
-
Write to word not using automation
You can write to Word not using automation. 1. Navision can write to file 2. You can use HTML 3. Word can open HTML files ExampleFileMyHTML File OutStream1 OutStream Customer Record Customer function wr(t :…
-
Lazy Programmers
Hi, For all people who want clean programming but do not want to put in loads of text If you compile Form.runmodal(form::form1) ORForm.runmodal(form::"1") It will generate Form.runmodal(form::"Company Information") Same goes for reports and dataports etc. Optionstrings: SalesLine.Type := SalesLine.Type::"2"; Makes…
-
Jan Doc/Due/Disc Date Hell
This seems to be a yearly occurance for me. I find myself constantly having to correct dates after posting. Yes, the posting limitations are in place but the users are so used to typing in 4 digits for the date that the doc date is wrong and as a result the due date & discount dates are wrong too. For example/ We usually…
-
Change the report font without programming
If a report is setup with the default font, the font can be changed if you run a report by selecting File-Page setup You can choose any font and it is saved in your zup-file.
-
Get the ClientAddress (IP) under Citrix
When you are working under citrix and you need the clientaddress of the connected users (the local IPs of the connected Client Pcs) you can do this with 2 Options: 1. You use the 'Citrix MetaFrame COM Library' This example shows all session and the connected Clientaddress, Clientname and Usernames Variables…
-
HOWTO write text files with long lines
What if you have to write a banking interface for Navision, where a line in the text file can easily more than 1024 chars long? 1) You cannot write one variable for a line, as a text var can only be 1024 chars long. 2) You cannot write in binary mode, as Navision will insert zero bytes after strings. 3) You could try to…
-
Check for, Create Directory
The folowing routine solves the problem: Does a directory <SearchDirectory> exist? If not, create it. Var SearchDirectory : Text200 rtFileSystem : Automation 'Microsoft Scripting Runtime'.FileSystemObject Begin SearchDirectory := 'C:\Temp\testdirectory'; CREATE(rtFileSystem); IF NOT…
-
A Question is not a tip
it's also not a trick. That's my tip :) Maybe it should be locked though, becaue it is not a Navision tip :-k
-
How to pass parameters from MenuSuite to opened form
In menusuite user can create hyperlink, and send form to menusuite as links. But creating links in MenuSuite designer is impossible. Fortunatelly editing hyperlinks works, so you can export MenuSuite to text file, add hyperlink here, and import it back to Navision. Then you edit change hyperlink in MenuSuite designer. When…
-
SMTP OCX 1.6, Error 10053 possible solution
Hello, excuses my bad English! Sometimes the smtp error 10053 can be released by the Firewall or the Virescanner. Smtp uses Port 25 these is protected with McAfee 8,0 by default. :!: Greetings from Mikka
-
RecordRef: How to select best key programmatically
The following code shows how to programmatically get the best key given the filters set on a recordref variable. RecRefGetBestKeyNo(rr : RecordRef) : Integer//The function returns the index of the best key to use given the applied filters.intBestKey := 1;//Enumerate all fields with filter. Temporary record used for…