Blank Item No.

Version 3.70 (3.70.A) Native

Got an Item Record with a no. Want to rename it to, but get the error

"You cannot rename a record because the old value of the field below is ‘’,

Field: No.

Table: Item"

Thing is the item in question has history, don’t really want to delete it.

Any suggestions?

BTW - The Item was blank when I got there.

T

Hi Tony

How did you manage to get an item with blank Item No.? This should not be possible.

However I have seen this a few times before, usually because a user have created a dataport that imports / updates items. An item with blank No. is created when the last line in the file is empty.

The history you see for the blank item is probably not related to the blank item. The Item No. on entries is being blanked out if you deleted an item so the entries you see with blank Item No. is probably related to deleted items.

Regards

Claus

P.S.

I forgot to say, I would just delete the item from code and without executing the OnDelete trigger code.

I’ve checked out the posted document descriptions, they are the right item!

Not sure who managed to do it, but they did!

And nobody noticed that while executing transactions over that item?

You can (probably) override navision’s “check code” that is checking wheter there are posted documents with that item or not. Everything would probably be ok after that except you’ll have a new item (at least, no Item No.) in a reports. Is there a lot of entries in ledger for it or it’s kind of minor priority item?

And nobody noticed that while executing transactions over that item?

LOL! Obviously not!

The items dead, but they want to rename it, so its not showing as a blank item, and they want to maintain the history.

Basically I want to know if there is anyway to bypass this rename “message”

If not I’ll just code a solution.

I’m not sure you need a “code solution”. At least on SQL server, if you simply rename Item No. it will rename all appropriate table entries (SQL 3.60, though…)

All you need is to bypass check code. If you have downtime (f.e. when nobody is logged on navision) do it in that time:

Comment out check code in Item table (OnModify trigger) and simply rename that Item No.

We did this on several occasions (only on one same clients database and on their explicit request) and it all went well but, do testing, ofcourse…

See above

This is not a piece of code on the Rename trigger, so I can’t comment it out!

Outch, sorry. [:$]

I missed the problem, I was thinking more about a problem of renaming item that has ledger entries.

Once, I had a same problem with unability to change from empty to non-empty No. and easy solution for me was to delete/create again that entry but in your case that is not applicable…

phuuuhh, sorry on sidetracking…

You do need to be careful here, you will have lines in orders that have Type::Item but a blank “No.” simply because nobody selected the item with the empty “No.”.

The first thing I would do is to write a report to go through each table where the “No.” = ‘’ and after checking order lines and posted document lines, delete the unwanted lines and rename each of the legitimate entries.

You may have to rem out the checks in some of the tables.

I have a client who has a blank “No.” also, but they use it as a generic entry.

Yeah, I know.

I’m just trying to find out if I can bypass this message, thats all!

If I can’t I’m pretty happy writing a rouinte to “fix” the data.

Not sure I would be happy deleteing “Unwanted Lines” in posted documents though!

Hi Tony

To my knowledge you can not bypass the error. Navision will not let you rename a blank primary key if the blank primary key has been used in “related tables”. In you case you can not rename the blank item as item ledger entries exist with blank item no. I guess Navision have made this blocking as Item No is being blanked in Item Ledger Entries when the Item is deleted (same goes for e.g. Customer and Vendor).

Regards

Claus

Well then, why not change the primary key, rename the record and then change the primary key back

Guess I’ll have to do it the old fahioned way then. [:D]