0

NAV - Quit - Break - Skip - Exit

Posted by Nantharupan on 7:01 AM in , , ,
When i was searching for the difference of these function, i found the answer from the following blog, i just copied that again for the quick reference. 
http://www.navisioncanbefun.com/2010/quit-break-skip-exit/

1. Quit 
Quit can only be used in Report, Dataport or XMLport. (Like Currreport.quit). It quits (come out from) the report or dataport or XMLPORT. If some processing of data happened before the quit statement, all of those data manipulations will be reversed (rolled back).
2. Break
Break can be used in 2 places –
a. in any loop (repeat..until) – This statement will break the loop and come out of the loop without further processing. All the data manipulation before this statement will remain intact.
b. In a report or dataport or XMLport. This statement will take you out from any trigger (like on prereport, Onpresection etc)
3. SKIP 
SKIP is only used in Report / Dataport / XMLPORT. This statement skips the iteration of a dataitem.
4. EXIT
EXIT normally used in functions / triggers to return a value. (say a function returns a numeric value –
Myfunction(integer A, Integer B) Integer—
EXIT(A+B);

0

VALIDATE() - NAV

Posted by Nantharupan on 5:21 AM
VALIDATE() function is call the triggers function for the field. 

When we add, delete or modify a record or filed of a record, we tend to do some validation for the fileds. This validations are put in the On validate trigger of the field. However if you just change the field without calling the VALIDATE function, this trigger will not be called. So if we want to call the VALIDATE function before changing the field, its better to call the VALIDATE function.

We can use the following syntax to validate the GeneralLedgerEntry record field "G/L AccountNo". 

GeneralLedgerEntry."G/L AccountNo" := '100';
GeneralLedgerEntry.VALIDATE("G/L AccountNo"); 

The above two lines can be written into a single line as follows. 


GeneralLedgerEntry.VALIDATE("G/L AccountNo", '100');


0

Regec - Find the Image src,width, height in HTML

Posted by Nantharupan on 3:26 AM
            string regexImgSrc = @"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>";
            string widthpattern = @"(?<=WIDTH:?)[0-9A-Za-z\s]+(?=;)";
            string heightpattern = @"(?<=HEIGHT:?)[0-9A-Za-z\s]+(?=;)";



0

GET - NAV

Posted by Nantharupan on 10:06 PM in , , ,
Its just a tip.

When ever we wanted to filter the record, we tend to use SETRANGE() or SETFILTER() and FINDFIRST()... However, we should keep in mind that, if we are filtering based on the Primary Key, then we can use GET(), it does all the work, we do by writing some lines of code with one life of code.

CustomerRec.RESET();
CustomerRec.SETRANGE("No.", 1291);
CustomerRec.FINDFIRT();


This can be done by using following code,

CustomerRec.GER(1291);

Hope this tip helped some one.!

0

Difference between SETRANGE and SETFILTER

Posted by Nantharupan on 12:15 PM in , , ,
We often face situation to filter record in NAV. There are two function can be used most of the time interchangeable for simple filters. However there might be performance consequences. 

  • SETFILTER()
       It can be assign a filter on a record to a filed we specify. It often used to do the complex filtering. 

  • SETRANGE()
       It is a simple filter, where single value or single range can be set on a field. 

SETRANGE give us a quick way to set up the Filer. 

CustomerRec.SETRANGE("No.", 100, 200); 

Above line simple filter the customer record with customer number from 100 to 200. 

The same functionality can be achieved by using SETFILTER() as follows

CustomerRec.SETFILTER("No.", '>=100&<=200');

We can see the difference. When using the SETFILTER() we should construct the filter statement. However we can not achieve complex filters using SETRANGE().

It is an incomplete post.....





0

NAV FIND() VS FINDFIRST(), VS FINDLAST()

Posted by Nantharupan on 1:26 PM in , , ,
FIND() is used with parameters. Based on the parameters passed in FIND()  different results set. 

  • FIND('-') : To search the first record in the table
  • FIND('+') : TO search the last record in the table.

However FIND is an old function. Instead of FIND('-') FINDFIRST() function can be used, FINDLAST() function can be used instead of FIND('+'). 

After searching in the internet, it seems FINDFIRST(), FINDLAST() functions are efficient and faster compared to the FIND('-'), FIND('+').

However when it comes to REPEAT,UNTIL function, We shouldn't use FINDFIRST().





0

How to Import Excel into MS SQL database table.

Posted by Nantharupan on 1:00 PM in , ,
I was asked to import the data from the Excel to MSSQL database. I wasn't aware of how to do that. However i found the way to do that. I hope this would help some one. 

So Steps,

1. Save the sheet/file as .csv, (Save the file with the same name of the data table would make your life easy )
2. Make sure the column name matches with the data base column names. 
3. Right click on the data base  and select task and import
4. Choose a Data Source -- Choose the Flat File as Type and Particular File,
5. Choose a Destination -- Choose the Destination as SQL Native Client, 
6. Select the data base and Authentication 
7. Make sure all the columns are mapped correctly, 
8. Finish and see are there any errors, (keep in mind there can be data loses, so make sure the whole process fails or success on such occasion by setting the right fails)

Key Points to note

  • Make sure there are no data could loss
  • Make sure the right local
  • Make sure the right column mapping 

Popular posts

Copyright © 2009 On the way All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.