Wednesday, June 8, 2016

Add a QR Code to a Dynamics NAV 2015/2016 in Report Header

Add a QR Code to a Dynamics NAV 2015/2016 in Report Header
Hi All,
This article will demonstrate how to add a QR Code to a NAV 2016.

For this example I have made a copy of the Order Confirmation Report (ID 205) and save it as QR Order Confirmation (ID 50023).

I have redirected the Company Information Picture field in the report to point to a new BLOB field in the Sales Header Table (ID 36) called “QR Code”.

Note: If you need QR Code Generator Solution Objects, Then ping me, It's free of cost available for learning purpose.
Step 1:  Open Sales Header Table [ID 36] and Add fields [see the bellow screenshot].


After Added fields add some code in OnInsert trigger [see the bellow screenshot].



Step 2:  Create a new codeunit for ”QR Code” functionalities.
                In my case i seted the property Table No with value  ”Sales Header”,
        [ See the bellow screenshot].





In this Codeunit i wrote  four functions for relating QR Code, i.e.
1.       CreateQRCodeInput
2.       GetQRCode
3.       GetBarCodeProvider
4.       MoveToMagicPath

 See the bellow screenshot of full ”QR  Code Management” Codeunit C/AL Code.





Step 3:  Create a Report, In my case i made Save as of Report ID 205 ” Order Confirmation”.
                In that i made some changes:
1.       QRCodeManagement varible of Codeunit of 50010 ” QR Code Management” that earlier created.
2.       Added Data item fields for getting the QR Code Image from Sales Header [See the screenshot].





3.       Add couple of lines in ”Sales Header” OnAfterGetRecord Trigger, to run the ”QR Code Management” Codeunit  and get the QR code image from ”Sales Header” Table [see the bellow screenshot].





Step 4:  Open Report Layout design and create a Image control in Report Header, In my case i used earlier company logo field and populate with new QR fields that i created in Report dataitem [see the bellow screenshot].




After changes save report and exit.

Step 5:  Run the report that you created with require filters [see the bellow screenshot].








Tuesday, May 24, 2016

POWERSHELL SCRIPT CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED

WINDOWS 8 – POWERSHELL SCRIPT CANNOT BE LOADED BECAUSE RUNNING SCRIPTS IS DISABLED

I just stumbled upon an interesting Technet blog for Windows scripts here.

Attempting to run a Powershell script however generated the following error: [See bellow screenshot].




 The link provides plenty of information – so this is a precis of what you need to know, as well as the change to make to run Powershell scripts.

First let’s take a look at the Powershell execution policies – Restricted is the default policy and it prevents the running of scripts.

Our other alternatives are:

AllSigned – Scripts can run but must be signed by a trusted publisher
RemoteSigned – Scripts can run. Trusted publisher scripts must be signed. Scripts that you have written yourself do not need to be digitally signed.
Unrestricted – Unsigned scripts can be run and the user is warned before running downloaded scripts.
Bypass – nothing is blocked and there are no warnings or prompts.
For full disclosure on these policies review the Execution Policies link above.
Choose your alternative Execution Policy carefully – Restricted is the only policy that can save you from running malicious code (signed or unsigned) on your system!
Next we need to be aware of the Execution Policy scopes:
Process – only affects the current Powershell process.
CurrentUser – affects only the current user.
LocalMachine – affects all users on the computer.
So now let’s open up Powershell and review our current Execution Policy. From the Start screen just type Powershell and click on it in the search results.

Enter the following command to review the current policy:
Get-ExecutionPolicy -List
As you can see my default policy is Undefined (which is the same thing as Restricted):



So now we can change the Execution Policy for the CurrentUser Scope to RemoteSigned. If you wish to choose a different scope and/or policy then be my guest:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Note: You will see the following warning – press Enter to continue: [See the bellow screenshot].



              We can now check and see that the policy has been changed:
Get-ExecutionPolicy -List





To finally run the Powershell script I had to run Powershell as an Administrator (right click and Run As Administrator).

Now enjoy your Powershell !

-------------------------- EXAMPLE 1 --------------------------









Monday, May 16, 2016

Reserved Keywords on NAV 2016

Hi All,
     Today I'm going to post Reserved Keywords on NAV 2016.

Overview
In a computer language, a reserved word (also known as a reserved identifier) is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use".

C/AL has several reserved words that you cannot use as variable, constant, or function names in your application. Reserved words include the following types:
  • Data types
  • Keywords
  • Functions
  • Operators
  • Properties
  • System variable names
  • Triggers
In some cases, you can use reserved words as variable names if you enclose the variable name in quotation marks. However, we do not recommend this practice.
If you write code on client report definition (RDLC) report layouts, then verify that your code does not use Visual Studio Report Designer reserved words.

List of Reserved Words
     The following table lists all of the C/AL reserved words.

Reserved word
Type
Abs
Function
Action
Data type
Activate
Function
Active
Function
ActiveControlOnOpen
Property
Addlink
Function
Addtext
Function
AltSearchField
Property
And
Operator
Applicationpath
Function
Array
Functions
ArrayLen
Function
Ascending
Function
AssertError
Keyword
AssistEdit
Property
AutoCalcField
Property
AutoEnter
Property
AutoFormatExpr
Property
AutoFormatType
Property
AutoIncrement
Property
Automation
Data type
AutoPosition
Property
AutoRepeat
Property
AutoReplace
Property
AutoSave
Property
AutoSplitKey
Property
AutoUpdate
Property
BackColor
Property
BackTransparent
Property
BackupKey
Property
Beep
Function
Begin
Keyword
BigInteger
Data type
BigText
Data type
Binary
Data type
Bitmap
Property
BitmapList
Property
BitmapPos
Property
BlankNumbers
Property
BlankZero
Property
BLOB
Data type
Boolean
Data type
Border
Property
BorderColor
Property
BorderStyle
Property
BorderWidth
Property
BottomMargin
Property
Break
Function
CalcDate
Function
CalcField
Function
CalcFields
Function, Property
CalcFormula
Property
CalcSum
Function
CalcSums
Function
CallFieldValidate
Property
Cancel
Property
Caption
Function, Property
CaptionBar
Property
CaptionClass
Property
CaptionML
Property
CardPageID
Property
Case
Keyword
ChangeCompany
Function
Char
Data type
CharAllowed
Property
ChartPartID
Property
CheckLicenseFile
Function
Class
Function
Clear
Function
ClearAll
Function
ClearLastError
Function
ClearMarks
Function
ClearOnLookup
Property
ClientType
Function
Close
Function
ClosingDate
Function
ClosingDates
Property
Clustered
Property
Code
Data type
CodeCoverageLog
Function
Codeunit
Data type
CommandLine
Function
Commit
Function
CompanyName
Function
CompressArray
Function
Compressed
Property
Confirm
Function
Consistent
Function
ContainerType
Property
ContextURL
Function
ControlAddin
Property
ControlType
Property
ConvertStr
Function
Copy
Function
CopyArray
Function
CopyFilter
Function
CopyFilters
Function
CopyLinks
Function
CopyStr
Function
CopyStream
Function
Count
Function
CountApprox
Function
Create
Function
CreateDateTime
Function
CreateGUID
Function
CreateInstream
Function
CreateOutstream
Function
CreateTempFile
Function
CurrentClientType
Function
CurrentDateTime
Function
CurrentExecutionMode
Function
CurrentKey
Function
CurrentKeyIndex
Function
CurrentTransactionType
Function
CurrPage
System Variable
CurrReport
System Variable
Database
Function
DataCaptionExpr
Property
DataCaptionFields
Property
DataItemIndent
Property
DataItemLink
Property
DataItemLinkReference
Property
DataItemSeparator
Property
DataItemTable
Property
DataItemTableView
Property
DataLength
Property
DataPerCompany
Property
Date
Data type
Date2DMY
Function
Date2DWY
Function
DateFormula
Data type, Property
DateTime
Data type
DaTi2Variant
Function
Debugger
Function
Decimal
Data type
DecimalPlaces
Property
DecimalPlacesMax
Function
DecimalPlacesMin
Function
Default
Property
DefaultClientType
Function
DefaultFieldsValidation
Property
DelayedInsert
Property
DelChr
Function
Delete
Function
DeleteAll
Function
DeleteAllowed
Property
DeleteLink
Function
DeleteLinks
Function
DelStr
Function
Description
Property
DeviceFontName
Property
Dialog
Data type
Dimensions
Property
Direction
Property
Div
Operator
Divisor
Property
DMY2Date
Function
Do
Keyword
Download
Function
DownloadFromStream
Function
DownTo
Keyword
DrillDown
Property
DrillDownPageID
Property
DropDown
Property
DT2Date
Function
DT2Time
Function
Duplicate
Function
Duration
Data type
DWY2Date
Function
Editable
Function, Property
Ellipsis
Property
Else
Keyword
Enabled
Function, Property
EnabledIfError
Property
EnabledIfInsertion
Property
EnabledIfSelection
Property
Encoding
Property
End
Keyword
Environ
Function
EOS
Function
Erase
Function
Error
Function
Evaluate
Function
Event
Keyword
Exists
Function
Exit
Keyword
Export
Function
ExportObjects
Function
ExtendedDataType
Property
False
Keyword
Field
Function
Field No.
Property
FieldActive
Function
FieldCaption
Function
FieldClass
Property
FieldCount
Function
FieldEndDelimiter
Property
FieldError
Function
FieldExist
Function
FieldIndex
Function
FieldName
Function
FieldNo
Function
FieldRef
Data type
FieldSeparator
Property
FieldStartDelimiter
Property
FieldValidate
Property
File
Data type
FileFormat
Property
FileName
Function, Property
FilterGroup
Function
Find
Function
FindFirst
Function
FindLast
Function
FindSet
Function
Focusable
Property
FocusOnClick
Property
FontBold
Property
FontItalic
Property
FontName
Property
FontSize
Property
FontStrikethru
Property
FontUnderline
Property
For
Keyword
ForeColor
Property
Format
Function, Property
FreezeColumnID
Property
FunctionType
Property
Get
Function
GetFilter
Function
GetFilters
Function
GetLastErrorText
Function
GetPosition
Function
GetRangeMax
Function
GetRangeMin
Function
GetRecord
Function
GetStamp
Function
GetSubtext
Function
GetTable
Function
GetURL
Function
GetView
Function
GlobalLanguage
Function
GroupTotalFields
Property
GroupType
Property
GUIAllowed
Function
GUID
Data type
HandlerFunctions
Property
HasFilter
Function
HasLinks
Function
HasValue
Function
HeadingHeight
Property
Height
Function, Property
HideValue
Property
HorzAlign
Property
HorzGlue
Property
HorzGrid
Property
Hyperlink
Function
ID
Property
If
Keyword
Image
Property
Import
Function, Property
Importance
Property
ImportObjects
Function
In
Operator
IncludeInDataSet
Property
InColumn
Property
InColumnHeading
Property
IncStr
Function
Indent
Property
Indentation
Property
IndentationColumnName
Property
IndentationControls
Property
InFooterBar
Property
InFrame
Property
Init
Function
InitValue
Property
InlineEditing
Function, Property
InMatrix
Property
InMatrixHeading
Property
InPage
Property
Input
Function
Insert
Function
InsertAllowed
Property
InsStr
Function
InStream
Data type
InstructionalTextML
Property
Integer
Data type
InvalidActionAppearance
Property
IsAction
Function
IsAutomation
Function
IsBinary
Function
IsBoolean
Function
IsChar
Function
IsClear
Function
IsCode
Function
IsCodeunit
Function
IsDate
Function
IsDateFormula
Function
IsDecimal
Function
IsEmpty
Function
IsFile
Function
IsInstream
Function
IsInteger
Function
IsNullGUID
Function
IsOption
Function
IsOutstream
Function
IsRecord
Function
IsText
Function
IsTime
Function
IsTransactionType
Function
KeepWithNext
Property
Key
Property
KeyCount
Function
KeyGroupDisable
Function
KeyGroupEnable
Function
KeyGroupEnabled
Function
KeyGroups
Property
KeyIndex
Function
KeyRef
Data type
Language
Function
LeaderDots
Property
LeftMargin
Property
Len
Function
Length
Function
LinkedInTransaction
Property
LinkedObject
Property
LinkFields
Property
LinksAllowed
Property
LinkTable
Property
LinkTableForceInsert
Property
Local
Keyword
LockTable
Function
LockTimeout
Function
LogHeight
Function, Property
LogWidth
Function, Property
Lookup
Property
LookupPageID
Property
LookupMode
Function, Property
Lowercase
Function
MaintainSIFTIndex
Property
MaintainSQLIndex
Property
Mark
Function
MarkedOnly
Function
MatrixColumnWidth
Property
MatrixSourceTable
Property
Maximizable
Property
MaximizedOnOpen
Function, Property
MaxIteration
Property
MaxLength
Property
MaxOccurs
Property
MaxStrLen
Function
MaxValue
Property
MenuItemType
Property
MenuLevel
Property
Message
Function
Minimizable
Property
MinimizedOnOpen
Function, Property
MinOccurs
Property
MinValue
Property
Mod
Operator
Modify
Function
ModifyAll
Function
ModifyAllowed
Property
MultiLine
Property
MultipleNewLines
Property
Name
Function, Property
Namespaces
Property
NamespacePrefix
Property
NewPagePerGroup
Property
Next
Function
NextControl
Property
NodeName
Property
NodeType
Property
NormalDate
Function
Not
Operator
NotBlank
Property
Number
Function
Numeric
Property
ObjectType
Function
Occurrence
Property
OCX
Data type
Of
Keyword
OnAction
Trigger
OnActivate
Trigger
OnAfterAssignField
Trigger
OnAfterAssignVariable
Trigger
OnAfterExportRecord
Trigger
OnAfterFormatField
Trigger
OnAfterGetField
Trigger
OnAfterGetRecord
Trigger
OnAfterImportRecord
Trigger
OnAfterInitRecord
Trigger
OnAfterInput
Trigger
OnAfterInsertRecord
Trigger
OnAfterModifyRecord
Trigger
OnAfterTestRun
Trigger
OnAfterValidate
Trigger
OnAssistEdit
Trigger
OnBeforeEvaluateField
Trigger
OnBeforeExportRecord
Trigger
OnBeforeImportRecord
Trigger
OnBeforeInput
Trigger
OnBeforeInsertRecord
Trigger
OnBeforeModifyRecord
Trigger
OnBeforePassField
Trigger
OnBeforePassVariable
Trigger
OnBeforePutRecord
Trigger
OnBeforeTestRun
Trigger
OnClosePage
Trigger
OnControlAddin
Trigger
OnDeactivate
Trigger
OnDelete
Trigger
OnDeleteRecord
Trigger
OnDrillDown
Trigger
OnFindRecord
Trigger
OnFormat
Trigger
OnInit
Trigger
OnInitReport
Trigger
OnInitXMLport
Trigger
OnInputChange
Trigger
OnInsert
Trigger
OnInsertRecord
Trigger
OnLookup
Trigger
OnModify
Trigger
OnModifyRecord
Trigger
OnNewRecord
Trigger
OnNextRecord
Trigger
OnOpenPage
Trigger
OnPostDataItem
Trigger
OnPostReport
Trigger
OnPostSection
Trigger
OnPostXMLport
Trigger
OnPreDataItem
Trigger
OnPreReport
Trigger
OnPreSection
Trigger
OnPreXMLItem
Trigger
OnPreXMLport
Trigger
OnPush
Trigger
OnQueryClosePage
Trigger
OnQueryClosePage
Trigger
OnRename
Trigger
OnTimer
Trigger
OnValidate
Trigger
Open
Function
Option
Data type
OptionCaption
Function, Property
OptionCaptionML
Property
OptionString
Function, Property
OptionValue
Property
Or
Operator
Orientation
Property
OSVersion
Function
OutStream
Data type
PadChar
Property
PadStr
Function
Page
Data type
PageNames
Property
PageNamesML
Property
PAGENO
Function
PagePartID
Property
PageType
Property
PaperSize
Property
PAPERSOURCE
Function
PaperSourceDefaultPage
Property
PaperSourceFirstPage
Property
PaperSourceLastPage
Property
PaperSourceOtherPages
Property
ParentControl
Property
PartType
Property
PasswordText
Property
PasteIsValid
Property
Percentage
Property
PermanentAssist
Property
Permissions
Property
PlaceInBottom
Property
PopulateAllFields
Property
Pos
Function
Power
Function
Preview
Function
PrintOnEveryPage
Property
PrintOnlyIfDetail
Function, Property
ProcessingOnly
Property
Promoted
Property
PromotedCategory
Property
PromotedIsBig
Property
ProviderID
Property
PushAction
Property
Query
Object
QueryReplace
Function
Quit
Function
Random
Function
Randomize
Function
Read
Function
ReadConsistency
Function
ReadPermission
Function
ReadText
Function
Rec
System Variable
Record
Data type
RecordID
Data type, Function
RecordLevelLocking
Function
RecordRef
Data type
RecordSeparator
Property
Relation
Function
Rename
Function
Repeat
Keyword
Report
Data type
ReqFilterFields
Property
ReqFilterHeading
Property
ReqFilterHeadingML
Property
RequestOptionsPage
System Variable
Reset
Function
RightMargin
Property
Round
Function
RoundDateTime
Function
RowHeight
Property
Run
Function
RunCommand
Property
RunPageLink
Property
RunPageOnRec
Property
RunPageView
Property
RunModal
Function
RunObject
Property
SaveAsExcel
Function
SaveAsHTML
Function
SaveAsPDF
Function
SaveAsXML
Function
SaveColumnWidths
Property
SaveControlInfo
Property
SavePosAndSize
Property
SaveRecord
Function
SaveValues
Property
SectionHeight
Property
SectionWidth
Property
Seek
Function
SelectLatestVersion
Function
SelectStr
Function
SerialNumber
Function
SetAutoCalcFields
Function
SetCurrentKey
Function
SetFilter
Function
SetPermissionFilter
Function
SetPosition
Function
SetRange
Function
SetRecFilter
Function
SetRecord
Function
SetSelectionFilter
Function
SetStamp
Function
SetTable
Function
SetTableView
Function
SetView
Function
ShapeStyle
Property
Shell
Function
ShortCutKey
Property
ShowAsTree
Property
ShowCaption
Property
ShowPrintStatus
Property
ShowStatus
Property
SID
Function
SignDisplacement
Property
SingleInstance
Property
Sizable
Property
Skip
Function
Sleep
Function
SourceExpr
Property
SourceField
Property
SourceTable
Property
SourceTablePlacement
Property
SourceTableRecord
Property
SourceTableTemporary
Property
SourceTableView
Property
SourceType
Property
SQL Data Type
Property
SQLIndex
Property
StartPos
Property
STARTSESSION
Function
STOPSESSION
Function
StrCheckSum
Function
StrLen
Function
StrMenu
Function
StrPos
Function
StrSubstNo
Function
Style
Property
StyleExpr
Property
SubPageLink
Property
SubPageView
Property
SubType
Property
SumIndexFields
Property
SynchronizeAllLogins
Function
SynchronizeSingleLogin
Function
System
Data type
SystemPartID
Property
TableBoxID
Property
TableCaption
Function
TableFilter
Data type
TableIDExpr
Property
TableName
Function
TableNo
Function, Property
TableRelation
Property
Temporary
Property
TemporaryPath
Function
TestField
Function
TestTableRelation
Property
Text
Data type
TextEncoding
Function
TextMode
Function
TextPos
Function
TextType
Property
Then
Keyword
Time
Data type
TimerInterval
Property
Title
Property
To
Keyword
Today
Function
ToolTip
Property
ToolTipML
Property
TopLineOnly
Property
TopMargin
Property
TotalFields
Property
TOTALSCAUSEDBY
Function
TransactionType
Data type, Property
TransferFields
Function
True
Keyword
Trunc
Function
Type
Function
Until
Keyword
Update
Function
UpdateControls
Function
UpdateEditable
Function
UpdateFontBold
Function
UpdateForeColor
Function
UpdateIndent
Function
UpdateOnAction
Property
UpdateOnActivate
Property
UpdateSelected
Function
Upload
Function
UploadIntoStream
Function
Uppercase
Function
UseRequestPage
Property
UserID
Function
UseSystemPrinter
Property
Validate
Function
ValidateTableRelation
Property
Value
Function
ValuesAllowed
Property
Var
Keyword
VariableActive
Function
VariableName
Property
Variant
Data type
Variant2Date
Function
Variant2Time
Function
VertAlign
Property
VertGlue
Property
VertGrid
Property
Visible
Function, Property
While
Keyword
Width
Function, Property
WindowsLanguage
Function
With
Keyword
WithEvents
Property
WordDate
Function
Write
Function
WriteMode
Function
WritePermission
Function
WriteText
Function
XMLport
Data type
XMLVersionNo
Property
XOR
Operator
XPos
Function, Property
xRec
System variable
Yield
Function
YPos
Function, Property


References: MSDN



Popular Posts