Newbie Autonumbering Fields after sort.

  • Follow


Hello,

I have a simple table that displays an Item Number (one item per
record) I also have a Date and a Time field. I want to create a script
that sorts the table by Date and Time, and then to automatically
renumber the Item Numbers based on this chronological sort. I may also
want to add (+) a value stored on a separate table to this series.

For example, on a separate table I have "Previous Number of Items"
amount ( a single number). Lets say the number is 120. After the sort,
I want the first record to be 121, then 122 and so on.

Also, I want to store on the separate table, the total number of
records in the Item table + the "Previous No. of Items". So basically,
what script do I use to count the total number of records in a given
table.

Many thanks for all the help!!
0
Reply Nando 8/15/2005 2:10:07 AM

Nando wrote:

>Hello,
>
>I have a simple table that displays an Item Number (one item per
>record) I also have a Date and a Time field. I want to create a script
>that sorts the table by Date and Time, and then to automatically
>renumber the Item Numbers based on this chronological sort. I may also
>want to add (+) a value stored on a separate table to this series.
>
>For example, on a separate table I have "Previous Number of Items"
>amount ( a single number). Lets say the number is 120. After the sort,
>I want the first record to be 121, then 122 and so on.
>
>Also, I want to store on the separate table, the total number of
>records in the Item table + the "Previous No. of Items". So basically,
>what script do I use to count the total number of records in a given
>table.
>
>Many thanks for all the help!!

Look at the Replace Field Contents script step.

Matt
0
Reply Matt 8/15/2005 9:17:31 AM


Nando wrote:

>Hello,
>
>I have a simple table that displays an Item Number (one item per
>record) I also have a Date and a Time field. I want to create a script
>that sorts the table by Date and Time, and then to automatically
>renumber the Item Numbers based on this chronological sort. I may also
>want to add (+) a value stored on a separate table to this series.
>
>For example, on a separate table I have "Previous Number of Items"
>amount ( a single number). Lets say the number is 120. After the sort,
>I want the first record to be 121, then 122 and so on.
>
>Also, I want to store on the separate table, the total number of
>records in the Item table + the "Previous No. of Items". So basically,
>what script do I use to count the total number of records in a given
>table.
>
>Many thanks for all the help!!

Answer to the second question:

Create a calc field using the Count function.

Matt
0
Reply Matt 8/15/2005 11:25:47 AM

Thank you Matt, but I think this will only replace the field only in
the current record. I need the script to cycle thru all the records
after the chronological sort.

Thanks again,
Nando




On Mon, 15 Aug 2005 09:17:31 GMT, "Matt Wills" <I'm@Witz.end> wrote:

>Nando wrote:
>
>>Hello,
>>
>>I have a simple table that displays an Item Number (one item per
>>record) I also have a Date and a Time field. I want to create a script
>>that sorts the table by Date and Time, and then to automatically
>>renumber the Item Numbers based on this chronological sort. I may also
>>want to add (+) a value stored on a separate table to this series.
>>
>>For example, on a separate table I have "Previous Number of Items"
>>amount ( a single number). Lets say the number is 120. After the sort,
>>I want the first record to be 121, then 122 and so on.
>>
>>Also, I want to store on the separate table, the total number of
>>records in the Item table + the "Previous No. of Items". So basically,
>>what script do I use to count the total number of records in a given
>>table.
>>
>>Many thanks for all the help!!
>
>Look at the Replace Field Contents script step.
>
>Matt

0
Reply Quite 8/15/2005 4:23:39 PM

That's what the 'Replace' function is there for.
You should read the Help.
Remi-Noel


"Quite Curious" <not@home.com> a �crit dans le message de news: 
78g1g15jmifna78680u57lono8sqbhkp2h@4ax.com...
> Thank you Matt, but I think this will only replace the field only in
> the current record. I need the script to cycle thru all the records
> after the chronological sort.
>
> Thanks again,
> Nando
>
>
>
>
> On Mon, 15 Aug 2005 09:17:31 GMT, "Matt Wills" <I'm@Witz.end> wrote:
>
>>Nando wrote:
>>
>>>Hello,
>>>
>>>I have a simple table that displays an Item Number (one item per
>>>record) I also have a Date and a Time field. I want to create a 
>>>script
>>>that sorts the table by Date and Time, and then to automatically
>>>renumber the Item Numbers based on this chronological sort. I may 
>>>also
>>>want to add (+) a value stored on a separate table to this series.
>>>
>>>For example, on a separate table I have "Previous Number of Items"
>>>amount ( a single number). Lets say the number is 120. After the 
>>>sort,
>>>I want the first record to be 121, then 122 and so on.
>>>
>>>Also, I want to store on the separate table, the total number of
>>>records in the Item table + the "Previous No. of Items". So 
>>>basically,
>>>what script do I use to count the total number of records in a given
>>>table.
>>>
>>>Many thanks for all the help!!
>>
>>Look at the Replace Field Contents script step.
>>
>>Matt
> 


0
Reply Remi 8/15/2005 4:53:09 PM

Replace Field Contents performs the replacement on the specified field in 
all records in the found set.

In fact, FM Help specifically mentions what you want to do as one of the 
possible uses for the step:

"This step can also be used to reserialize a field in every record in the 
current found set."

Matt

Quite Curious wrote:

>Thank you Matt, but I think this will only replace the field only in
>the current record. I need the script to cycle thru all the records
>after the chronological sort.
>
>Thanks again,
>Nando
>
>
>
>
>On Mon, 15 Aug 2005 09:17:31 GMT, "Matt Wills" <I'm@Witz.end> wrote:
>
>>Nando wrote:
>>
>>>Hello,
>>>
>>>I have a simple table that displays an Item Number (one item per
>>>record) I also have a Date and a Time field. I want to create a script
>>>that sorts the table by Date and Time, and then to automatically
>>>renumber the Item Numbers based on this chronological sort. I may also
>>>want to add (+) a value stored on a separate table to this series.
>>>
>>>For example, on a separate table I have "Previous Number of Items"
>>>amount ( a single number). Lets say the number is 120. After the sort,
>>>I want the first record to be 121, then 122 and so on.
>>>
>>>Also, I want to store on the separate table, the total number of
>>>records in the Item table + the "Previous No. of Items". So basically,
>>>what script do I use to count the total number of records in a given
>>>table.
>>>
>>>Many thanks for all the help!!
>>
>>Look at the Replace Field Contents script step.
>>
>>Matt

0
Reply Matt 8/15/2005 11:21:42 PM

5 Replies
293 Views

(page loaded in 0.312 seconds)

Similiar Articles:













7/17/2012 9:30:08 PM


Reply: