Friday, 6 May 2016
Add leading zero's / characters
It's been over a year since my last update, ouch, but here is a note to myself. I needed to add leading zero's to strings which were too short. In order to do so, use the strRFix function. It takes your string, counts the number of characters and adds leading characters (zero's in my case).
I had different lengths of strings but I always needed six characters, filled with leading zero's. The outcome in the first place was:
51070
4690
372
I needed six characters, which can be accomplished with the following command:
strRFix(inputString,6,'0');
it will result in:
051070
004690
000372
Perfect :).
Friday, 20 February 2015
BEX error when trying to connect to AX
Today we encountered a problem on our dev environment when trying to connect to AX.
The error in the Eventviewer:
Fault bucket , type 0
Event Name: BEX
Response: Not available
Cab Id: 0
Problem signature:
P1: Ax32.exe
P2: 5.0.1500.3761
P3: 4cd58bc2
P4: Ax32.exe
P5: 5.0.1500.3761
P6: 4cd58bc2
P7: 006172e8
P8: c0000417
P9: 00000000
P10:
Attached files:
These files may be available here:
C:\Users\xxxx\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Ax32.exe_d55e154f46603fcd51ce8f1cc09170939b3699_2d75a946
Analysis symbol:
Rechecking for solution: 0
Report Id: 1fb4056b-b90c-11e4-8361-005056b2000b
Report Status: 0
To fix there are some options, but the first one won't work on AX
Option 1:
The error in the Eventviewer:
Fault bucket , type 0
Event Name: BEX
Response: Not available
Cab Id: 0
Problem signature:
P1: Ax32.exe
P2: 5.0.1500.3761
P3: 4cd58bc2
P4: Ax32.exe
P5: 5.0.1500.3761
P6: 4cd58bc2
P7: 006172e8
P8: c0000417
P9: 00000000
P10:
Attached files:
These files may be available here:
C:\Users\xxxx\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_Ax32.exe_d55e154f46603fcd51ce8f1cc09170939b3699_2d75a946
Analysis symbol:
Rechecking for solution: 0
Report Id: 1fb4056b-b90c-11e4-8361-005056b2000b
Report Status: 0
To fix there are some options, but the first one won't work on AX
Option 1:
- my computer
- go to properties
- click on advanced system settings
- under performance, click settings
- click the Data Execution Prevention tab, and then click Turn on DEP for all programs and services except those I select.
- click Add, browse to the executable file for the program and add it.
Option 2:
In order to be able to start AX, you need to start CMD as admin and then execute the following command: bcdedit.exe /set nx AlwaysOff
Thursday, 5 February 2015
Using wild cards in X++ select statements
Some time a ago I had to make a select statement, excluding some batchId's which started with BN14.
In a select statement in X++, you can use wildcards like this;
while select inventBatch
where inventBatch.inventBatchId like 'BN14*'
However, if you'd like to exclude a set of batches which start with BN14 you need a slight different statement:
while select inventBatch
where !(inventBatch.inventBatchId like 'BN14*')
In a select statement in X++, you can use wildcards like this;
while select inventBatch
where inventBatch.inventBatchId like 'BN14*'
However, if you'd like to exclude a set of batches which start with BN14 you need a slight different statement:
while select inventBatch
where !(inventBatch.inventBatchId like 'BN14*')
Wednesday, 5 November 2014
Rebuild indexes
And another small post for the archive. If you'd like to rebuild an index (due to fragmentation or growth), you can use the following statement:
USE
[namedatabase]
ALTER
INDEX ALL ON [dbo].[nametable] REBUILD;
Deploy reports AX 2012
Another small post for my own archive. To deploy a report, you can use the following command in powershell
Publish-axreport -servicesaosname 01@nameAOS -servicesaoswsdlport 8101 -reportname PurchPurchaseOrder
Publish-axreport -servicesaosname 01@nameAOS -servicesaoswsdlport 8101 -reportname PurchPurchaseOrder
Tuesday, 4 November 2014
Inventsum recalculation
Due to different kinds of problems, it can be needed to recalculate the inventsum for an item. The cause is most of the time incorrect manipulation of the inventtrans records (due to manual adjustments or for example incorrect software modifications).
There's the possibility to run the consistency check which will recalculate the onhand stock for all items. This is an operation which can take a serious amount of time. If you'd only want to recalculate for one item:
InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("itemnumber", true, checkfix::fix);
InventSumRecalcItem.updatenow();
There's the possibility to run the consistency check which will recalculate the onhand stock for all items. This is an operation which can take a serious amount of time. If you'd only want to recalculate for one item:
InventSumRecalcItem InventSumRecalcItem;
;
InventSumRecalcItem = new InventSumRecalcItem("itemnumber", true, checkfix::fix);
InventSumRecalcItem.updatenow();
Friday, 5 September 2014
Shrink logfile dynamics AX
Just a small post for my own archive. I ran into a problem of not having enough space left after deleting a company in AX (the logfile became too big) in my own testenvironment (recovery model is set to simple).
Shrinking did not solve it. I needed a full backup first, but there's the problem again, no diskspace left :). There appears to be a backup faker for both the db and the db log and after running it, you can shrink the database.
alter database
"dbname" set
recovery full
GO
backup database
"dbname" to
disk='nul'
GO
backup log
"dbname" to
disk='nul'
GO
alter database
"dbname" set
recovery simple
GO
And finally Shrink and the logfile is back in proportian.
Edit: a small update, after a restore of another database, in order to be able to log in, use this script:
Edit: a small update, after a restore of another database, in order to be able to log in, use this script:
UPDATE dbo.UserInfo
SET networkdomain='domain',networkalias='networkname', sid='sidid'
WHERE id='admin';
Subscribe to:
Posts (Atom)