consultancy chorley ASP.NET Server Side Scripting Wigan
Website Development Radcliffe

A Coder's Notes

Email :
bespoke invoice systems Standish Information Technology Advice Worsley
    development systems Ramsbottom
data manipulation Farnworth access databases Whitefield SQL connections Atherton
online accessible software Leyland software compatible Coppull

Get connected and Online Tottington
remote management Makerfield code and design Aspull

Stock Check List Order Updates - 29/09/2010

This morning I've been working on Leisuredrive's stock check list.  

The stock table has over 700 items.  This table of items needs to be brought up as a report ready to be printed for a stock check.  Getting the 700 items in order is a job in itself.  I have added a "displayorder" column to the table.  This column holds a numerical value.  Now if the table would be fixed into one order then once the "displayorder" has been set the work is done.  However new items come into the stock system and older items are removed, the table will be ever-changing.

This means I needed to create a web page with the correct options to re-order the "displayorder" field.  This page lists all the items in the stock list with a radiobutton beside them, and another radiobutton between them.  The item to be moved is selected, then where it will sit, between other items, is selelcted.  That was the easy bit!

Creating the SQL and the maths was much more complicated.  Essentially you need to create a space first in the list, so...

     ...4, 5, 6, 7, 8, 9, 10...

needs to become

     ...4, 5, 6, 8, 9, 10, 11...

note the missing "7" the list now.  Now we have the space we update the table to set the "displayorder" of the tiem to be moved to the now missing "7".  Sounds easy?  So far yes.  Now imagine we have a new space where our item has moved from.  I need to re-order all the numbers ABOVE that space to fill the gap.  I'll not bore you any more with the details suffice to say it too wuite a while to work out.

The beauty of computers though is that once you have worked it out, it keeps on working working working.  The task of finding each item amongst the 700 other items is still fiddly...but Firefox's and IE's seach facility helps a great deal. 

Cheers, Ren. 

THe Stock List Re-Ordering Page.  It shows the radio buttons and the stock items that allow the display roder to be changed


Post A Comment

Name Comment
programming services specialist
Valid XHTML 1.0 Transitional