Metres to Feet and Inches Calculations and related

# Thread: Metres to Feet and Inches Calculations and related

1. Iain Stewart Guest

## Metres to Feet and Inches Calculations and related

I am using ASP pages with an Access database.<BR>I have a &#039products&#039 page/table where the length and width of each item needs to be searchable either in metric or imperial (feet, inches) sizes and where metre size also determines shipping cost.<BR>The client provides length and width details of each product either as metres or as feet and inches, entirely at random. What I need to know falls into three parts:<BR>1. How and where (in ASP or Access) can I best set it up that any Length/Width sizes I enter in metres are automatically converted to Feet and Inches, and vice versa?<BR>2. When metres are converted into Feet (as via Excel&#039s CONVERT function) the result is given as a decimal value of feet - how do I change and reformat this into &#039normal&#039 feet and inches. (e.g. How do I convert 7.65 feet into 7&#039 8", including the rounding up of 7.8" to 8")?<BR>3. What is the most efficient way of calculating Shipping Cost based on a formula of each item&#039s square metres size turned into Kilos (eg 1 square metre = 3 kilos, shipping cost per kilo is 10 dollars)<BR>Being just an ASP and database newbie from an HTML background, I have looked high and low for sample applications in which these kind of calculations are addressed but can&#039t surprisingly find anything. Any enlightenment however basic on how to set about these increasingly urgent tasks would be greatly appreciated - I am meant to present the finished project to the client in a few weeks.<BR>Thanks a lot<BR>Iain.

2. Senior Member
Join Date
Dec 1969
Posts
626

## RE: Metres to Feet and Inches Calculations and rel

You should probably try to standarized the database to hold only metric values. When searching you&#039ll need to convert search criteria to the proper format. e.g. if the user enters search criteria in feet and inches use a function to convert that to metric values. You can also have a function to calculate shipping cost. If you put these functions into a seperate asp file they can be included on any page that you would need to use them.<BR><BR>Let&#039s say we have these two functions in a file called "ConvFunctions.asp" in the folder called "inc" ...<BR><BR>&#060;%<BR>Function GetMetric(pFeet, pInches)<BR>Dim MetricValue<BR>...Calculation Code...<BR>GetMetric = MetricValue<BR>End Function<BR><BR>Function GetShipCost(pLength, pWidth)<BR>Dim ShipCost<BR>... Calculation code ...<BR>GetShipCost = ShipCost<BR>End Function<BR>%&#062;<BR><BR>If you add this line of code to the top of an asp page you will have acces to those functions...<BR>&#060;!-- #INCLUDE VIRTUAL="/inc/ConvFunctions.asp" --&#062;<BR><BR>What kind of products are you dealing with? It may be wise to store the weight of each product in the database to calculate shipping costs. It seems to me that a product that is 1 meter long and 1 meter wide may not weigh the same as a different product with the same dimensions. At my job we deal with many different items that vary greatly in density. A truckload of Millet Sprays may weigh only 35,000 lbs while a truckload of Sunflowers (same volume) might weigh 45,000 lbs.<BR><BR>If you have the weight of each item in the database freight calculation is a simple formula: Quantity * Weight * FreigthRate<BR>

3. Iain Stewart Guest

## RE: Metres to Feet and Inches Calculations

Thanks for your suggestion, although I&#039m still not clear on the conversion from say 10&#039 (or 10 feet) 11" (or 11 inches) to a metric decimal value, and vice versa (10.9 feet is a lot easier)<BR><BR>The product invovled is Oriental rugs, and the size detail is therefore crucial for customers, plus can be entered as either metric of Imperial (Europeans don&#039t understand Americans and the other way round when it comes to measurements). Also, the weight per square metre, although averaged, is reasonably accurate to work on for the shipping costs, especially as people don&#039t buy (or sell) carpets by weight, but that&#039s how they ship them.<BR><BR>I could still do with a little more help on this whole thing, but thanks a lot in the meantime.<BR><BR>Iain

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•