Options

Batch report changes data in other companies

mplatvoetmplatvoet Member Posts: 34
edited 2008-01-03 in SQL General
I have a weird thing:

I create a batch report on a table (table is local, so each company has its own table and also in SQL Server the companyname+$ prefix).

I change a decimal field in the table with te report with the following code in the OnAfterGetRecord trigger:

<field> := ROUND(<CurrentFieldValue>,0.01);
MODIFY;

In other words I rounded the fieldvalue. I didn't use the table prefix.

What happened was that this also was executed in the other company in the database! I never seen this before and wonder what could have caused this.

I used SQL Server 2005 and NAV 4.0 SP3 UPDATE4.
Anyone seen this before? And knows what could cause this?

Comments

  • Options
    kinekine Member Posts: 12,562
    Are you sure that it was executed in other companies by running it in one of them? How did you check that? Is working someone else on the database too?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    mplatvoetmplatvoet Member Posts: 34
    I ran the report using CTRL+R from the designer, I didnt save it.
    So it was not present in the object designer.

    Before I ran it I saw that all fields had 4 or 5 digits in both companies, afterwards only 2, in both companies.

    It really looks like it had run in both companies, but I cannot explan why.
  • Options
    kinekine Member Posts: 12,562
    How did you look at the table? If you look directly to the table in NAV, you will see as many decimals as configured on the field. If you look through SQL, you will see all decimals. If you look through form, you will see as many decimal as set on the form or field. It means you can have different result with different methods of viewing the data...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    mplatvoetmplatvoet Member Posts: 34
    Before and afterwards I checked on the form. Before I ran the report it showed 4/5 decimals and afterwards 2...
  • Options
    kinekine Member Posts: 12,562
    It is weird, because by default all decimal fields are in NAV set to 2 decimal places. How was the table filled in? Through NAV or SQL?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    mplatvoetmplatvoet Member Posts: 34
    Not when you run the adjust item/cost prices and then recalculate the unit price with factor 1.05.
    The field I am talking about is the Item Unit Price.

    For your reassurance: I Validated the field after I rounded it.
  • Options
    kinekine Member Posts: 12,562
    Ok, I thought that it were some new field you created. Precision of Unit cost is set through G/L Setup field "Unit-Amount Rounding Precision". And the precision can be related to used Currency (each currency can have different precision)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.