Thursday, December 13, 2012

Installing on SQL Server 2000

If you need to install Acinta Shortcut on a SQL Server 2000 then there are a couple of changes you need to make. They are briefly described below.

Views

  1. "Acinta_Split" not supported. You'll see an error like this: "Syntax error near a". Acinta_Split is used to decipher "Tælleværker" in C5. Table-valued functions are not supported by SQL Server 2000. You have to remove/comment out all SELECT statements using this function. As a result, you'll not be able to see the results of "Tælleværker".
  2. Top N not supported. A couple of places contain sub-queries in the form:
    SELECT TOP 1 <Expr>
    .....
    ORDER BY ....

    This must be rewritten to:
    SELECT MAX(<Expr>)
    .....

    These functions were introduced in SQL Server 2005.
    How to solve: Replace TOP 1 with MAX( ) and remove the ORDER BY clause.
  3. Row_number() and RANK not supported. In one place these functions are used. There is no simple way to express this function in SQL Server 2000 so the simplest solution is to replace the whole expression by "NULL". If you need this function you'll have to rewrite it yourself. However, it is rarely used so don't worry.

Indexes

Indexes in SQL Server 2000 don't allow the INCLUDE columns. You have to rewrite the indexes and put all needed columns in the main index part. Remember there's a limit of 16 fields per index.

In addition, the "WITH" sub-clause specifying index options, is not supported and must be removed.

For example you have to rewrite this index:
CREATE NONCLUSTERED INDEX [ACINTA_IX_ProjTrans] ON [dbo].[PROPOST]
(
[DATASET] ASC,
[DATO] ASC,
[LXBENUMMER] ASC,
[NUMMER] ASC,
[ART] ASC,
[VARENUMMER] ASC,
[LOKATION] ASC,
[MEDARBEJDER] ASC,
[ENHED] ASC,
[BUDGETKODE] ASC,
[TRANSAKTION] ASC,
[VALUTA] ASC,
[PROTYPE] ASC,
[KOPIERET] ASC,
[OVERFXRTLXN] ASC
)
INCLUDE ( [ANTAL],
[KOSTBELXB],
[TEKST],
[BELXBVAL],
[BELXBSTD],
[DRIFTSFXRTANTAL],
[DRIFTSFXRTBELXBVAL],
[DRIFTSFXRTBELXBSTD],
[KURS],
[DRIFTFXRTLXNTILLXGVAL],
[DRIFTFXRTLXNTILLXGSTD]) WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO

to something like this:
CREATE NONCLUSTERED INDEX [ACINTA_IX_ProjTrans] ON [dbo].[PROPOST]
(
[DATASET] ASC,
[DATO] ASC,
[NUMMER] ASC,
[ART] ASC,
[VARENUMMER] ASC,
[LOKATION] ASC,
[MEDARBEJDER] ASC,
[BUDGETKODE] ASC,
[TRANSAKTION] ASC,
[VALUTA] ASC,
[PROTYPE] ASC,
[OVERFXRTLXN] ASC,
[ANTAL],
[KOSTBELXB],
) ON [PRIMARY]
GO

Other considerations

How do I know which SQL Server version it is?

In order til check the version of SQL Server you need to open SQL Server Management Studio (or Enterprise Manager for older versions) and connect to the server.
The internal version number can be read in the red box: 10.
The internal version numbers have this meaning:
8: SQL Server 2000
9: SQL Server 2005
10: SQL Server 2008
11: SQL Server 2012

Beware of "Compatibility mode"!

SQL Server provides a feature called "Compatibility mode" that enables a newer version of SQL Server to pretend it is an older version. The background for this obscurity is of course to allow older applications to work seamless with newer versions of SQL Server that they were not designed for.

Thus, what may at first sight look like e.g. SQL Server 2008 could in fact be an SQL Server 2000. Or actually it is not that simple. When SQL Server runs in compatibility mode for SQL Server 2000 then the following applies:
  1. It does not recognize newer SQL features such as "TOP" and "Row_number( )". Thus, the fix for these features applies.
  2. It will allow you to create table-value functions (Acinta_Split) but it won't let you use them, thus the remedy for this applies.
  3. It still allows you to create indexes with Included columns. So there's no need to rewrite indexes!
One last thing to consider is whether the compatibility mode is actually correct or if it should be set to the actual version. But you have to verify this; if you change the compatibility mode it may cause some applications to malfunction!

Tuesday, July 10, 2012

Installing on C5 with non-standard schema (not 'dbo')

If you need to install Acinta on a C5 that has been installed with a non-standard schema then you need to make some adjustments to the installation procedure as described below.

How do I know that C5 is installed with a non-standard schema?

When you look at the C5 tables in SQL Server Management Studio you will see that all tables have a pre-fix that is different than 'dbo'.
For example, the table "SALESLINE" could look like this:
c5_supervisor.SALESLINE

instead of this:
dbo.SALESLINE

How do I install on a non-standard schema?

To install Acinta on such a C5 you need to follow the normal installation procedure with these extra steps:
  1. Update Index script. Before installing the indexes you must perform a search-and-replace in the index script where you replace all occurrences of 'dbo.' with the actual schema name.
  2. Rename tables in Modeller. When you open the project in Modeller initially, Modeller will start the Rename wizard because it can't find the tables it is looking for. All you have to do is to follow the instructions on the screen. For example Modeller will tell you: "The table dbo.SALESLINE no longer exists. Do you want to replace it?" and then in the list of tables below you simply select the proper replacement table - c5_supervisor.SALESLINE in this example - and click "Rename"
  3. Update Dynamic Views. You have to locate all dynamic views in Modeller's Warehouse section. Right-click on the dynamic view table's header and choose "Edit Dynamic View SQL" from the context menu. Review the SQL and make sure all table references use the correct schema prefix

Wednesday, May 9, 2012

"Syntax error near a" and the Acinta_Split() function

I have come across this error while compiling the view/dynamic view "ACINTA_DV LedgerOfAccountsRelation" in the C5 data model:
"Syntax error near a".

It happens in this line of the view:

    SELECT COUNT(*)
    FROM Acinta_Split(';', a.TXLLEVXRK) x



The error occurs because SQL Server does not recognize the function "Acinta_Split", which is part of the Acinta Shortcut package.

Now, the function was actually compiled and present in the system, so the error seems mysterious at first.
It turns out that the database was configured to have compatibility level 80 = SQL Server 2000.

And since table-based functions were introduced in SQL Server 2005 it is also the natural explanation why SQL Server throws a syntax error at us.

Solution

To get out of this error you have two choices:

  1. Set the compatibility level of the database to at least 90 (SQL Server 2005)
  2. Comment out the parts of the view that make use of the Acinta_Split function. Block comments have the form: "/* <commented code> */
Obviously, you should choose solution 1. whenever possible. But under some circumstances this is not possible. One such circumstance is when you have a C5 version 3.0 solution, because this version of C5 is only compatible with SQL Server 2000; It does not work with later versions of SQL Server.

Applies to

Please note that this error and its solution applies generally and not just to the C5 solution. I.e. it may apply to:
  • Acinta Shortcut for C5
  • Acinta Shortcut for Ax
  • Acinta Shortcut for Nav
  • Acinta Shortcut for XAL
  • Acinta Shortcut for Visma

Wednesday, April 18, 2012

Datashop crashes at startup


If you are experiencing that Datashop crashes before it even displays its splash screen and you get a message from Windows that the application crashed then the cause is probably restrictions on the user's permissions.


The possible scenario is that you are trying to make an installation without running the Acinta installer, e.g. a network installation. The installation works fine for you (because you use a classified account, e.g. Administrator) but it fails on end-users' PCs.

 SOLUTION   Right-click on the exe-file or shortcut and choose "Run as administrator...". You only need to do this once. Next time you open Datashop it will work fine.

Friday, March 30, 2012

Project takes long time to load - slow loading


Sometimes when you have installed a new project or you are opening the project from a different computer you may experience that the loading of the project is notably slow.

There are several possible causes for this problem.

Possible causes

Old version of Acinta Intelligence Suite

Check if the version of Intelligence Suite you are trying to open is up to date. If metadata was edited using a newer version then it may have stored properties that are not understood by older versions. When this happens, an error trapping mechanism is invoked that writes all the unrecognized properties to the log file. You can verify the problem by investigating the log file.

SOLUTION  Update the .exe files to a new version.


Upgrade to Acinta Intelligence Suite 2014

If you recently upgraded to Acinta Intelligence Suite 2014 from an older version then the problem may be caused by obsolete properties in metadata. I.e. properties that are no longer supported by the new version. Such properties cause internal validation errors and a lot of writing to the log-files.

SOLUTION  You must "clean" the metadata by loading the project in Modeller and run the "Repair" utility and then save the project. It is best to use the option "Save all objects" but it may take somewhat longer to process.


Slow network

A lot of metadata must be transferred over the network when Datashop, Modeller etc. opens a project. A slow network may cause this process to take a very long time. Note: Look out for wireless networks since these are notably slower than wired networks.


SOLUTION  Wire the PC to a cable or upgrade/fix problems in the (wireless) network.

Too little RAM

If the server has too little RAM to fit all the running processes inside then some memory will be mapped to disk. Since disks are multitudes slower than RAM this will inevitably lead to prolonged load times during start-up because thousands of dynamic objects are created representing metrics, dimensions, dashboards etc. This problem is typical of virtual machines where RAM is often a scarce resource to be shared across many virtual machines.


SOLUTION  Enhance the server with more RAM. If the server is a virtual machine it should be considered whether the RAM is dedicated to the server or dynamically shared. Dedicated RAM is better.


Antivirus system interference

Antivirus software such as Trend Micro may cause the project to load extremely slow due to dynamic scanning of running processes.

SOLUTION  Turn off the antivirus system or the parts hereof that cause the problem, e.g. "process scanning". Or perhaps better: Add the Acinta applications (Datashop, Modeller etc.) to the antivirus' so-called White-list to prevent the AV software from scanning these applications at run-time.

Friday, January 13, 2012

Fiscal/financial year date calculations

As a followup to my previous article on calculation of dynamic dates I will demonstrate how we can make similar calculations that take the company's financial year into consideration.

This is important for companies that have a financial year that is not coinciding with the calendar year. In Denmark the financial year typically starts at the beginning of a quarter, i.e.:

  • 1st of January
  • 1st of April
  • 1st of July, or
  • 1st of October

Thus, if in our dashboard we want to use a "year-to-date" filter then we actually want the filter to span from the beginning of the financial year till today's date.

Such a filter condition can be implemented using this SQL:

DATEADD(dd, 0, DATEADD(mm, 6, DATEADD(yy, CASE WHEN MONTH(getdate()) >= 7 THEN YEAR(getdate()) ELSE YEAR(getdate()) - 1 END - 1900, 0)))
The result of this expression (assuming today's date is January 13th 2012) is:
'2011-07-01'
i.e. an ISO formatted date, which should be valid in any SQL Server.

The above example assumes that the financial year starts on July 1st, but obviously you can use the approach for any start day of the financial year.

To change the starting month of the financial year you simple have to modify the script in two places:

  • 6: Replace this value with the last month in the financial year
  • 7: Replace this value with the first month in the financial year


Filter modifiers
As usual, date functions are very useful with filter modifiers. Using a filter modifier you can implement a report where the user selects a date and then your filter modifier transforms the selection into a "year-to-date" date range using the user's selection.

To use the above script in a filter modifier you simply have to replace the occurences of "getdate()" with the desired filter modifier placeholder, {Value1} or {Value2}.

I.e. you need to use this variation of the SQL expression:

DATEADD(dd, 0, DATEADD(mm, 6, DATEADD(yy, CASE WHEN MONTH({Value1}) >= 7 THEN YEAR({Value1}) ELSE YEAR({Value1}) - 1 END - 1900, 0)))