Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Tuesday, November 26, 2013

Adding image through external resource for Dynamic AX 2012

How to use resource files in Axapta

In AOT, you can find resources node

Select resources node and right click; select Create from File, specify the file location for the new resource 

file. After that you can use this resource file in Axapta without specifying an absolute file path in your 

local/server system.

First, pick up the resource node from AOT;

SysResource::getResourceNode(); 

Then generate a temporary file for this resource file;
SysResource::saveToTempFile() 

Finally specify the temporary file path for controls. 

Here comes an example to show how to use a resource file as a background image of  a given form. 

{
ResourceNode            resourceNode;
FilePath  imagename;
;
resourceNode = SysResource::getResourceNode(resourcestr(ResourceName));
if (resourceNode)
{
resourceNode. AOTload();
imagename =  SysResource::saveToTempFile(resourceNode);
}
else
{
throw Error(“No file exists.”)

element.design().imageName(imagename); 
}

Example:

You can try "Resources" node to achieve your requirement.
Just Add a new resources under "Resources" node in AOT, than use following X++ code to access that image..
SysResource::getResourceNodeData(SysResource::getResourceNode('theaxapta_File'));

How to give null/ space if the values is zero in SSRS 2012

Hi,
 Just enter the syntex as expression for SSRS
=iif(Fields!FieldName.Value > 0,  Fields!FieldName.Value,  space(0))

Regards,

Monday, November 18, 2013

update_recordset , insert_recordset, Delete records and select record of SQL in Dynamic AX 2012


//Select query in Dynamic AX 2012
 MyTable myTableBuffer;
;
Select myTableBuffer
where field1 == 0;
//use while select for multiple select

// Update query in Dynamic AX 2012

MyTable myTableBuffer;
;
update_recordset myTableBuffer
setting
    field1 = 1,
    field2 = fieldX + fieldY
where field1 == 0;

//Delete query in Dynamic AX 2012
 
static void DeleteMultiRow1aJob(Args _args)
{
    MyWidgetTable tabWidget;
    ;
    delete_from tabWidget
        where tabWidget .quantity <= 100;
}
 

// Insert query in Dynamic AX 2012
insert_recordset myTable (Field1, Field2)
    Field1= “QWERTyuioP”
Field2 = “ASDFghjkl” ;
 


Thursday, November 14, 2013

To take complete back up of SQL in single code

DECLARE @name VARCHAR(100)
DECLARE @path VARCHAR(256)
DECLARE @fileName VARCHAR(256)
DECLARE @fileDate VARCHAR(20)
SET @path = 'G:\BACKUP'
SELECT @fileDate = CONVERT(VARCHAR(20),GETDATE(),112) + '_' +REPLACE(CONVERT(VARCHAR(20),GETDATE(),108),':','')
DECLARE db_cursor CURSOR FOR
SELECT name
FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb')
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name
WHILE @@FETCH_STATUS = 0
BEGIN
SET @fileName = @path + @name + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName
FETCH NEXT FROM db_cursor INTO @name
END
CLOSE db_cursor
DEALLOCATE db_cursor

Wednesday, November 13, 2013

AX2012 R2 Retail installation, DB profile, AOS profile and Commerce data syn service setups

Hi,

1. Architecture of the Microsoft Dynamics AX Retail 2012 R2 


We need to understand the modify architecture of Ax2012 R2 retail.  
Main Components
1.      Retail Headquarters.
2.      Commerce Data Exchange: Real-time Service (previously known as transaction service in Ax2009)
3.      Commerce Data Exchange: Synch Service.(previously known as Store connect in ax2009)
4.      Retail POS.
5.      .net Business connector.
Helping Component to do the configuration:
1.      Retail store database utility.
2.      Retail SDK.
3.      Retail online channel.
Open the Ax2012 R2 setup file and run (Before that Ax2012 R2 basic application should be install in your m/c).





Provide the name of the store DB and configure.
Same way do it for offline store DB.
Error: While configuring synch service you might get the following error.



Solution: Don’t configure the Synch service in setup time do it manually after successfully installation of all the retail components.
Go to the Programs>MicrosoftDynamicsAx2012> Retail store database utility
Open it and provide the below information to configure the store.



Don’t try to configure the offline DB after this because it will throw you an error.
Error: Store can’t not be found.
Reason: There is no data at this moment in the Store DB.
Configure the Synch service.
Go to the Programs>MicrosoftDynamicsAx2012> Retail synch service setting.
When you click add the server, it will prompt with Create a message database.
It will ask the database location and credential.
After successfully create of message DB, start the service and do the below setup.







Check that all the services are running stage or not.


Error: Sometime the Synch service shows starting stage and it remain unresponsive You can’t stop/start the service from here.
Solution: Go to the Task Manager and check the Service Processor ID.
Stop it from here and start.


Open Ax2012 R2 application do the following setup:
1. GO to the Retail>setup>Retail Scheduler>Channel integration.
Open AOS Profile

2.Open the Database profiles.


3.open the Synch Service.

  

Sometime we will get the following issue while doing test connection check.

 Reason:
Synch service is not started or we are not pointing the right Synch service or firewall related issue.
Check the setup and see the event viewer for more details.
Go to the System Administration>setup>Initial checklist>
 Go through all the step, main important is the schedule redeployment.
If it fails to insert certain data in some specific tables of Retail Store db, then we need to do it manually.


Go to the Retail>Periodic>Distribution schedule
Run the N-jobs
3 mandatory jobs need to be run 1st
1. N-1095
2. N-1090
3. N-1070
Then what are N- jobs you want to run ,run directly.
 Please check the below status once run the job.

Go to the Programs>MicrosoftDynamicsAx2012> Retail store database utility Open it and provide the below information to configure the store.
Configure offline DB.



You are ready to open the POS.
To configure the real time service you can follow the below link, it is quite helpful.
But I like to add some common troubleshooting on top of the above post which I faced while creating the web service.
 When you open the windows power shell open with Administrator and never use x86 power shell. Otherwise unable to install the Script in powershell, everytime it will fail.
 Enter Set-ExecutionPolicy Unrestricted –Force before the start any installation .\InstallCommerceDataExchangeRealtimeService.ps1
3.                 Be careful with Binary source path.
a.     C:\Program Files (x86)\Microsoft Dynamics AX\60\Commerce Data Exchange\Real-time Services\6.2\  \
4.                         ServerCertificateThumbprint
        You should remove the spaces from the 40-character string. Every time enter the value manually. Otherwise you will face the issue while opening the web service.
If you successfully install and configure the web service it should open like below.


For any other errors please check the below link.
  Configuring the Real-time Service in Retail Headquarters
Now that we have confirmed the Real-time Service Web service is working correctly, we need to configure it in Headquarters and push it down to the POS.
In Dynamics AX navigate to Retail > Setup > Retail scheduler > Channel integration > Real-time Service profiles.
As in previous versions, the Real-time Service profile is assigned to a specific register. Navigate to Retail > Setup > POS > POS registers and open a register. The profile you created should be assigned under General > Profiles:


Basic functional setup:
1. Do the setup of the Address book and a warehouse which is link with a store.



2.      Go CEU/Human resources/Common/Workers/Workers
Create your own worker.
Enter the Address books.
Go to the Retail Tab
Do the below mandatory setup.


Set the POS permission.

  




3.      Go to the retail store and create your own store.
CEU/Retail/Common/Retail channels/Retail stores


Add the worker in the store through employee address book.



Do the Setup of the Distribution Location under Retail>setup>retail scheduler 


Friday, November 1, 2013

Dynamics AX 2012 Reports services extension components installation-failed


Steps to resolve;


1. Open AOT > Services > SRSFrameworkService 
register it

It will clear or else
2. Open AOT > Services group > BIServices
Deploy it


Open AOT > Services group > UserSessionService
Deploy it
Now it will be cleared at last if not run complete (ful) CIL



FileNameSplit() to slip the Directory, file name and extension in D365 FnO

 Hi,     /// <summary>     /// Validate the Fileformat     /// </summary>     /// <param name = "filepath">FileP...