# Report displaying serial numbers

**URL:** <https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476>\
**Category:** Developers Forum\
**Created:** [December 12, 2005, 9:49pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476 "2005-12-12T21:49:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Chow](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@Alex\_Chow](https://www.dynamicsuser.net/u/Alex_Chow)\
**Post date:** [December 12, 2005, 9:49pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/1 "2005-12-12T21:49:56Z")

</div>

Hi, need to tap into some Navision geniuses… We’re programming a serial number printing scheme on reports. Since most of the serial numbers are in sequence, they can get away with using ‘-’ to annotate a sequence. However, if there’s a gap between the serial numbers, they want it in a new line. So for example, if the serial numbers are the following: A23450 A23451 A23452 A23453 A23454 123521 123522 123535 The report will display: A23450 - A23454 123521 - 123522 123535 The customer sells hundreds of items with serial numbers for a particular item, so it doesn’t make sense to list it out one by one. Any help would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![Steffen\_Voel](https://avatars.discourse-cdn.com/v4/letter/s/0ea827/32.png) [@Steffen\_Voel](https://www.dynamicsuser.net/u/Steffen_Voel)\
**Post date:** [December 12, 2005, 10:48pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/2 "2005-12-12T22:48:11Z")

</div>

Have a look at the INCSTR function (sorry, it’s late so I’m not going to elaborate)

---

<div class="post-metadata">

**Author:** ![Alex\_Chow](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@Alex\_Chow](https://www.dynamicsuser.net/u/Alex_Chow)\
**Post date:** [December 12, 2005, 11:11pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/3 "2005-12-12T23:11:00Z")

</div>

Yeah, we know about the INCSTR function. The most efficient code we came up with was along the line of: 1. Find the first SN entry 2. Do INCSTR until the next SN No. doesn’t match 3. Then concatenate the field for the first SN entry to the last matched SN No. 4. Set the record to the next SN Entry 5. Repeat until next = 0 Just want to get different ideas on how to proceed

---

<div class="post-metadata">

**Author:** ![Nelson](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@Nelson](https://www.dynamicsuser.net/u/Nelson)\
**Post date:** [December 13, 2005, 12:18am UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/4 "2005-12-13T00:18:50Z")

</div>

Sounds quite logical really. But maybe you shouldn’t have posted your current solution, it will influence other people’s thoughts. [;)]

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [December 13, 2005, 11:04am UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/5 "2005-12-13T11:04:04Z")

</div>

You will also need a temporary table to insert the results into prior to prininting, this will be easier than doing it on the fly.

---

<div class="post-metadata">

**Author:** ![Alex\_Chow](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@Alex\_Chow](https://www.dynamicsuser.net/u/Alex_Chow)\
**Post date:** [December 13, 2005, 5:25pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/6 "2005-12-13T17:25:26Z")

</div>

Temporary table? Can you please elobrate on the usage of a temporary table in this case?

---

<div class="post-metadata">

**Author:** ![Alex\_Chow](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@Alex\_Chow](https://www.dynamicsuser.net/u/Alex_Chow)\
**Post date:** [December 13, 2005, 5:27pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/7 "2005-12-13T17:27:24Z")

</div>

> **quote:**
> 
> | Sounds quite logical really. But maybe you shouldn’t have posted your current solution, it will influence other people’s thoughts. [;)]  
> _Originally posted by nelson - 2005 Dec 13 : 00:18:50_  
> |
> | --- |

Duh! Didn’t mean to do that… Just wanted to float some ideas around really…

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [December 13, 2005, 6:13pm UTC](https://www.dynamicsuser.net/t/report-displaying-serial-numbers/10476/8 "2005-12-13T18:13:33Z")

</div>

Its always hard to calculate exact text lengths positions counters etc. Much easier is to define a temproary variable, and populate this with the lines you want to print, and then print from that.
