Line No. doesn't work (pls assist me)

Dear All,

I’ve created line no. field in a table because it’s not available there but when running the table, the line no. field filled with data 0 (zero) actually it must 10,000.00; 20,000.00 etc according to the qty of data (sequenced), I wish it will be like service item line’s line no. field. Indeed I’ve set the datatype is integer but still not work when I run the table’s form. How to solve this problem ? tks for your answers

Rgds,

Mark

They ability for the Line No. to work as you want is done by the AutoSplitKey property on a form (it only works if done from a form)

In order for AutoSplitKey the field you want to increment must be an integer and must be the last field in the Primary Key.

If it is not part of the primary key or not the last field in the primary key, you need to add code to the OnNewRecord (Form only) or OnInsert (Form or table) trigger to calculate a new line no. manually.

I’ve just set that and can’t work. AutoSplitKey set to yes or no, can’t work too, the field have been set to be last field is also unable to make my field work good.

Rgds,

Mark

It has been set to be part of the primary key, I wonder why it’s needed coding meanwhile in the other table is work. [:(]

Rgds,

Mark

The rules for using the AutoSplitKey functionality in Navision are as follows:

There are two prerequisites for turning this property on:

  • The current key must be the primary key.

  • The last field in the primary field must be an integer BigInteger, GUID or decimal field. If these conditions are met, you can set this property to Yes.

Anyway, you need to set a filter to the remaining primary key fields, otherwise the number assigned will be invalid.

If you need to test this functionality you can:

Create a new Table

Add the following fields:

ID 1, Name PK1, Type Code,Length 10
ID 2, Name PK2, Type Integer
ID 3, Name Desc, Type Text, Length 30

Set the Primary Key to: PK1,PK2

Save the table.

Create a form with wizard (tabular-type form) for your table and add the Description field.

Finish the wizard, change AutoSplitKey to Yes and save the form.

Run the form and enter lines. You will see that the numbering works.
If you set a filter for PK1, you will see that the numbering starts at 10000 again and the PK1 field is prefilled with your filter value.

I jave uploaded a quick demo FOB which should help you to understand the issue.

Autosplitkey Demonstration

Tks for your answer. This is what I’ve done:

Primary Keys : Entry No.,Line No.

Enabled Field No. Field Name Data Type Length Description
Yes 1 Entry No. Integer
Yes 2 Line No. Integer

The problems I think maybe it caused by the first primary key is integer too. So what now, I can’t understand then.

Rgds,

mark

Might it be a good idea to attend a basic C/AL programmers training for Mark? On the many questions asked by Mark: Maybe Mark can give us some informations what he is trying to achive?

It does not make any difference, just take my example and change PK1 field to integer, it still should work.

I am surrender then. I don’t understand what else to write here. the PK1 is been in integer, before I add the line no. field, it has been a field with datatype is integer, then I add in the same line the pk2 with data type is integer. Do you think it must in the second line I put line no. in the primary keys table?

Rgds,

I don’t think so pal. I just need manuals, if you have manual files I think it would be a great help to me, just send me. I will send your my e-mail if you have.

Rgds,

How are you testing it?

Dear All,

Tks for your answers and efforts. I appreciate it so much. I am sorry I cancel to use field line no. because I can use entry no. field (that indeed it’s available since beginning) when designing codings I need. I need field whose datatype is integer. I close this topic and I think it maybe unsolved but why must continue if I can utilise the available field. I just don’t understand that if two fields whose their both datatypes integer exists as primary key in one line (sequenced) can’t work or show sequencing numbers (10000,20000,30000 etc…) if there are no codings for both. But why in the service item line, the line no. field seems having no codings, am I true…?

Rgds,

Mark