Record with RecId xxx in table ‘ProdTableProj’ has mismatching Sequence field values. Original value was xxx, new value is xxx.

While trying to save a change to a record in the ProdTable form, users were rewarded this message instead: 

Record with RecId xxx in table ‘Produktionsaufträge’ has mismatching Sequence field values. Original value was xxx, new value is xxx.

Ein Datensatz in Produktionsaufträge (ProdTableProj) kann nicht bearbeitet werden.

Die Datensatznummer entspricht nicht der ursprünglichen Nummer. Wenn die Tabelle den gesamten Tabellencache verwendet, liegt die Ursache möglicherweise darin, dass der Cache geleert wurde. Starten Sie den Einzelvorgang erneut, wenn dies der Fall ist.

 The change was actually saved, but they had to undo the change to be able to close the form.  Digging into the issue, I found that it was trying to insert a record into ProdTableProj which already existed.  It was trying to do this because prodTableProjOver in ProdTableForm was not being set properly.  To fix this, change “prodTableProjOver = datasources3;” to “prodTableProjOver = datasources4;“:

public void setDatasources(Common datasources1, Common datasources2 = null, Common datasources3 = null, Common datasources4 = null, Common datasources5 = null)
{
    ;
    prodTable = datasources1;
    inventDim = datasources2;
    prodTableProjError = datasources3;
    prodTableProjOver = datasources4;
    prodTable_ds = prodTable.dataSource();
    inventDim_ds = inventDim.dataSource();
    prodTableProjError_ds = prodTableProjError.dataSource();
    prodTableProjOver_ds = prodTableProjOver.dataSource();

    if (!prodTable_ds &&
        !inventDim_ds)
    {
        checkFailed(strfmt(“@SYS117974”, classId2Name(classidget(this))));
    }
}

Can’t save or compile code with a comment header containing an opening bracket

The following comment prevents code from being saved or compiled:

//(
static void Job1(Args _args) {}

This also won’t compile:

//naow9es5upaw398w04w43(p095wa
static void Job1(Args _args) {}

To save or compile, one would have to remove the opening bracket or add a space before it, like this:

// (
static void Job1(Args _args) {}

Or:

//naow9es5upaw39 8w04w43(p095wa
static void Job1(Args _args) {}

Hiding a control bound to an array field

When placed in the init method on a form, the following hides the Project control of the Dimension field in InventTable:

#define.Project(3)
;

inventTable_ds.object(fieldId2Ext(fieldNum(InventTable, Dimension), #Project)).visible(false);

End of Yesterday

For a while, I was using the following expression to set a package DateTime variable, @DateTo, to the end of yesterday:

DATEADD(“ms”, -2, DATEADD(“DAY”, DATEDIFF(“DAY”, (DT_DBTIMESTAMP)0, GETDATE()), (DT_DBTIMESTAMP)0))

Yet, while this worked consistently when run from Visual Studio or the Sql Management Studio, it was occassionally 3 milliseconds off when the package was run from an SQL job or launched from the dos prompt on the database server.  As a workaround, I set the package DateTime variable to the current time and modified the SQLStatement of the SQL Task to select with the end of yesterday:

DECLARE @Date DATETIME;
SET @Date = DATEADD(ms, -2, DATEADD(DAY, DATEDIFF(DAY, 0, @DateTo), 0));
INSERT  INTO …

Getting the total for last month in MDX

IIF(
        // Gets the last day of the last month when it is the last day of the current month.
        IsSibling(ParallelPeriod([Date].[Year Month Day].[Day], -1, [Date].[Year Month Day].CurrentMember),
         [Date].[Year Month Day].CurrentMember) AND
        IsLeaf(
            // Gets the last day of the month when the parallel day doesn’t exist.
            ParallelPeriod([Date].[Year Month Day].[Month], 1, [Date].[Year Month Day].CurrentMember)
            ),
        // Gets the same day last month
        ParallelPeriod([Date].[Year Month Day].[Month], 1, [Date].[Year Month Day].CurrentMember),
        // Gets the last day of last month
        ClosingPeriod(
            [Date].[Year Month Day].[Day],
            ParallelPeriod([Date].[Year Month Day].[Month], 1, [Date].[Year Month Day].CurrentMember.Parent)
            )
        ),
 [Measures].[Orders On Hand]

Object ‘QueryRun’ could not be created

When opening a query I had just imported from an xpo file, the query fails with the falling errors:

Fehler während der Verarbeitung: Query (Datenquelle) hat keinen gültigen ausführbaren Code in Methode ‘new’. (C)\Classes\Query\new (C)\Classes\QueryRun\new (C)\Classes\SysQueryRun\new – line 6 (C)\Classes\ClassFactory\QueryRunClass – line 5 queryRun kann nicht erstellt werden Objekt ‘QueryRun’ konnte nicht erstellt werden.

The workaround is to disable datasources until the error no longer appears.  Afterwards the datasources can be enabled again.

Report Builder 2.0 MDX Date Parameter Format

The following Report Builder dataset parameter expression converts a Date to an MDX string:
 
="[Date].[Day].&[" + Format(CDate(Parameters!Date.Value), "s") + "]"