Monday, February 13, 2017

Report Multiple Copies in Nav (Only Multiple Copies Easy in NAV 2016)

I Want to Share a small and very Easy way to make multiple copies like Sales order Report.
Firstly we have to be sure about Field we want to group by Like Sales order No in case for Sales Order which will be available in Sales Header Table.

Just Follow from Here.
I would Take Simply 3 Dataitems 
1.Integer datatitem For CopyLoop
2.Sales Header
3.Sales Line.

Indent the Above Three as Shown in Below Picture.


Now lets Design Request Page, we are talking about multiple Copies so we would ask user to enter No Of Required.
So Take 2 Global Variables Like Picture Shown below

Now Get to Request Page And Add two Fields First is Order No Then Second is No Of Copies.
Like Below


Now Select the OrderNo field Which you have now designed in Request Page And Press "Shift+F4"/Properties of that field And Make Table Relation To "Sales Header".No (This Is in My Case i.e Sales Order ).

We Have To Link The Sale Line dataItem With Sales Header as Many guys know Like Below

Code We Have To Write in Triggers See Below Pic

Now We Have to Dive into Layout Where Every thing is Done.

First add all the sales line Values you wanted in Layout Tablix Then
in Row Groups Select Details And Right Click on details  Select Add Group---)Parent Group
In Tablix Grouping properties With Select Group By SalesHeader No Like Below



Now Group With Number, Right Click on No salesHeader Row Group Then Select Group Properties
then In General Tab Select Add then in And On Select Number_Integer Of Integer dataitem Number.
This What Is makes the Multiple Copies in RDLC.


Dont Forget to Select The Page Break Option in Page Breaks Tab.

So The Layout Should Some What Like below it may vary as per your Design 





Save and Run .

Tuesday, May 31, 2016

Automatic No. Series in Nav

Most People might Already know this but as my blog name itself States for Beginners . For those who really starters might be  found Difficult, So For Them i hope it will Help.

First Lets Say you need No series for some List Of Items ,customers etc.. So First and foremost is to have a table. For Me An Example Table for which you want to enter data.
Table Name ------ Example Table
Table ID      ------ 50006
Table Fields ------ As per your Requirement But we one No. Field for auto increment.

Like Below Image.

Now it's Time to add some Default No Series i.e Automaticaally Adding No. For that you have to add a Field in Setup table . Example for Customers,vendors and Items the default no series are Defined in SalesSetup table . So you can Use such Tables Or you can make a Setup table New For your own .

So for this Example let us Just Use an old Setup Table/Standard Setup Table .ie Sales & Receivables Setup table  Table No 311.

 Create a New Fields Like Below
And  Edit  Table Relation Property Of Example Nos to  No. Series Like Below

Now go to page 459 i.e Sales & Receivables Setup page And Add a new Field in Numbering Fast tab like Below


Now run the Page And Select a No Series Or Create New "No series" by Following Respective steps


And most Important donot forget to check default Nos check box



then it should Look Like below Image
Now Coming to Code To Create automatic Nos is Take Global variables in  Table 50006/Example Table

And 2 Function Like Below

Then Write Code In OnInsert() And On Validate of No. Field. Like Below

Then Coming to First Function write like
Then the Most Important "AssistEdit" Function Which takes Example Table as Parameter you can replace it with your Desired Table.


Return a Boolean Value for function

Take Local variable record /same table as taken in parameter in above step and Name it as Example TableL

Now write Code like Below



So Coding Part is Done Now lets go for Creating a Page i.e Card page Standard.
Goto Object Designer Select Page Menu Now Create  a New Page ---> Enter Table Id 50006 in and Choose Create a page using Wizard. And Click OK Button
And Select All Fields And Click Finish Then you will See Card page

 Now Select No And Press F9 or got to Code in on Assist edit write code which will update page with automatic numbering..

Now save the Page And Compile .

Directly Compiling with check box  may give Error So First Save it and then close the Page , Reopen Page And Compile ...
So done

It's Evaluation Time ......
Run the Page

Click New page And Click other Fields or Simply Press Tab 2 times
I Hope It Helps .Please Let Me Know if you got any Problem Regarding this Post .

Monday, May 23, 2016

Convert Number To Words

Recalling This Codeunit Purpose ... One of my Most Respected Sir Asked Me Can You Describe the Overview How Would You Represent/Convert the  Number into Words. During My Initial Coding Days i have Done This. Just wanted To post/share So that it might be helpful for other saves times.

So Lets Start , Create a New Code Unit (it is not required to create new But to start Fresh) and Create Two Functions Like Below


Select the Second Function i.e Num2Word in Pic And Select Locals to define local variables And Parameters required.
Take Amount as parameter of type integer or you might use Decimal . i havent thought about it at that time..

take Local variables as above...
Define Return type as Text to function

Define text constants 
Define a Global variable that is word which is used across functions and it is Array of 28 so declare the dimensions as 28
Now lets get into code, 



So first i have declare all words that might possibly required have assigned into Array. Then i found the no of digits it got for a number/Amount.
Yes i forgot to say it Will convert number to  in millions i.e divisible by 1000s 
Example :
Input = 1000000 
Output = One Million


For suppose if you want To Convert into INR(Indian Currency) then make some Conditions Or Replace While Loop With Below Code

So then i will start a while loop will continue until number is Zero .
In loop i'm send remainder that of 1000 i.e Ones , tens and hundreds places then followed by thousands places followed by Millions  The Convertion Is done in another function which is recursive /called multiple times .

Lets get into another function...
Select Another Function and Start declaring its Locals variables, parameter and return value like below


This is Parameter which we use So make it variable by Checking var box to left
Return Value be text Length might be exception I think 
These are the variables  retword is nothing but word which we would return dig1,dig2,dig3 are digits 
respectively word1 ,word2 , word3 ones , tens and hundre...s  Arraynum is to Get the respective Word From word array which consists of 27 text words...  which we defined in previous Function i.e Num2Word.

So getting into code



First it finds 3rd digit i.e hundreds  by dividing num/100 and gets Respective word by Words[dig3]
then adds a Hundreds text at last. 

Then Value /Number is reduced by 1 digit By using Mod 100 So that if number is Less than 20 Or Greater then accordingly it retrieves Words...
Thus Returns A Final Word  to Num2Word fuction..

I hope you guys Understood Let me know if you Have any Doubts /found any mistakes .

If you Want to try my Objects Download From HERE

Thank You.:)

Friday, April 29, 2016

GDT Where Used Tool

Hi users,



Here i found a helpful tool for you. by using this tool you can find your objects and function you can see where it is used in entire nav. it is very much useful while upgradation.so here i am providing a link you can download it here

http://www.g-d-t.de/download.htm


Thank You

Tuesday, April 26, 2016

Warning: Ransomware Is On the Rise

A message appears on your computer: “You have visited illegal websites and must pay a fine of $200 to continue using your computer.” You discover that none of your files can be opened. All of their contents looks like Greek letters. What is going on?
You may ave been struck by the newest trend running around: ransomware. The malicious software (malware) encrypts all the files on your hard drive and asks for payment to unlock them.
Hands of a missing kidnapped abused hostage victim woman tied up with rope in emotional stress and pain afraid restricted trapped call for help struggle terrified locked in a cage cell.
Hands of a missing kidnapped abused hostage victim woman tied up with rope in emotional stress and pain afraid restricted trapped call for help struggle terrified locked in a cage cell.

How Does Ransomware Happen?

According to US-CERT (https://www.us-cert.gov/ncas/alerts/TA16-091A), ransomware is usually connected to other trojan or virus software. It infects your computer in many of the same ways malicious software has always worked. Attachments to emails, tainted downloads, and open network shares are common entry points.

Preventing Ransomware

There are the standard prescriptions for preventing malware, including:
  • Backups
  • Keeping your antivirus software up to date
  • Installing new operating system versions and security updates when they come out
  • Avoid web links and attachments in unsolicited emails.
All of these you can probably handle yourself. Other suggestions from US-CERT include:
  • Whitelisting software
  • Restricting user permissions
  • Restricting macros in emailed spreadsheets, word processing documents, and other like data
You can read the full report at https://www.us-cert.gov/ncas/alerts/TA16-091A.
Be careful out there!

Tuesday, February 16, 2016

Custom Report :Purchase Quantity of Items By Purchase Order No in Export To Excel.

This Report is based on The Requirement of Adam's Post So Thanks  to Him...

Overall Requirement
The Requirement is Report Which should Contain Purchase Details of Items in quantity Per Order No/Document No .

Result should be Like

As we all Know Order Nos/No of Orders Would be more and we would Get Error if you got more records in your table ...

So for the above problem the solution is
1.To Use Template which already Consists Of  Items  and Compare .
2. Dynamically print a Excel Sheet And Open And Compare them with Purchase Order Line items.


Now We are going to implement Second .
As per requirement i'm Using  3 Dataitems

Indention          Name
0                       Item1            //To Print Item List page.
0                       Purchase Line
1                       Item2         // to get wat respective Purchase Line Has.




Now Link item 2 with purchase line by Item No as like Select item2 and Select properties
Like Below DataitemLink.


Now Coming to Technical requirements as we have To Select Orders Range we need two code datatypes  and one filename for taking Excel Filename other For Sheetname ,One Excel Buffer of Record Datatype and Soon


Lets First Come From Request Page ... In Request page I Need  a FileName or select a Previous file created or Create a New File...And Select It and Give a Sheet Name. then

Two Lookup Fields For Document No in Purchase Orders Page....(56) that's It For Request Page

Code For File Name  and LookUp Code...


Same Above Code For End Document No /DocFilterEnd  lookup with Global variable assign to DocFilterEnd

So that these will Be Used To Set the Range / Filter
Request Page::



Now Coming TO Main Code

First  am Creating A New Item List Excel Sheet With Given FileNAme And SheetName then i will
loop through All Items So insert Item Values (Item No, Description) in Excel Sheet.

So that in Next Purchase Line Am Filtering List By Order No which is nothing But Document No...

using variables Passed In Request Page . then Searching /reading the sheet so that to find the value/item No in Purchase Line and When Found in The Respective Row creating a New Column and  Inserting the Values We Wanted (i.e Quantity)
then Result Would be like..


sorry lols For Unusual Sheet Name............
Here's Code

Just To Show My results Clearly i have set those item filter Remove That You will get all Items...



Sorry I Have Almost Got To say that i have Created Another Function i.e GiveUserControl1 So that it Wont Display My Excel Sheet After Creating ..I had Only Changed visible := False in that Excel Buffer.