Latest News: OOTP 13 Announced with Screenshots & Feature List! Pre-Order Now! - OOTP Baseball 12 Available! - iOOTP Baseball 2011 Available! - Title Bout Championship Boxing 2.5 released! - Inside the Park Baseball Patch 1.03 released, DEMO now available

Pre-Order OOTP 13, Save & Win! | OOTP 12 Off-Season Special, just $19.99!

Go Back   OOTP Developments Forums > Out of the Park Baseball 12 > OOTP Mods > OOTP Mods - Database Tools

OOTP Mods - Database Tools Do you need to take a dump? SQL gurus welcome

Reply
 
LinkBack Thread Tools Display Modes
Old 08-04-2006, 12:52 PM   #1 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
Converting Height?

anyone know how any tips on how to convert the height in the sql dumps from cm to feet and inches using mysql? thanks.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 08-28-2006, 11:00 PM   #2 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
anyone???
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 08-29-2006, 02:08 AM   #3 (permalink)
21C
Minors (Double A)
 
Join Date: Mar 2003
Location: Newcastle, Australia
Posts: 167
Thanks: 7
Thanked 5x in 4 posts
Divide it by 2.54 to get it into inches.

Edit - sorry, didn't see the part about doing it in MySQL. Can't help you with that.

Last edited by 21C; 08-29-2006 at 09:21 AM.
21C is offline   Reply With Quote
Old 09-05-2006, 06:15 PM   #4 (permalink)
Bat Boy
 
Join Date: Jul 2003
Location: Los Angeles, CA but currently in Putney, VT
Posts: 6
Thanks: 0
Thanked 0x in 0 posts
Well I think this may work for getting the height into inches (this is based upon mysql hopefully it works in other sql). I don't know much about sql besides administering databases online but I found this in one of hte books I have.

The modulo operator; evaluates to the remainder of m divided by m % n is the same as MOD(m,n).. As with division, the modulo operator with a divisor of zero returns NULL.

Here is a quote from Sam's MySQL

"The modulo operator; evaluates to the remainder of m dived by m % n is the same as MOD(m,n). As with division, the modulo operator with a divisor of zero returns NULL."

So therefore I think you can do the following

Multiply cm x .39 then divid by 12 and strip anything to the right of the decimal point if one is returned. If you dont have any decimals then it is obviously a nice round number divisible by .39 which is very unlikely. When you do have something that is stripped then you have to take the original number you got after doing the first operation and then use the % to get the remainder which you add on to the original cmx.39 result stripped of the decimals.

c=cm

(cmx.39)/12=a
a (rounded down, stripped of decimals whatever you want to call it or use to get a round number) is the number of feet.

a%12=r
R is the remainder and is the inches number. So therefore you can display as fllows

A feet r inches and then make sure that you put somethign in there so that it does not show anythign for the inches if the remainder comes back as 0 and so that it says inch rather than inches if it is 1.

Some modification will be needed as .39 is NOT an exact conversion factor so you may get a little error and you WILL need to round the inches using whatever method you choose so that you can get what you need, I'd say just round to the nearest whole number .
I hope this helps but as I don't really understand too much of any type of sql and this is from a mysql book I'm not sure it will help but I hope you find it useful and it helps you figure out your conundrum.


FIXED!
__________________
It's called baseball not foosball!

Last edited by YoVivoPorSPORTS; 09-07-2006 at 01:08 AM.
YoVivoPorSPORTS is offline   Reply With Quote
Old 09-14-2006, 01:11 PM   #5 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
this doesnt work, dont use it
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:44 PM   #6 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
i stand corrected, this formula will work.

the problem is that all the neccessary info wasnt here that i need to make it work, so i will reclarify it:

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:47 PM   #7 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
converting height

$total_inches = 0.3937008*$AR_result[ 'height' ];
$feet = $total_inches/12;
$inches=$total_inches%12;
then to display, all you need is this:

echo floor($feet)."' ".$inches."'';

i got it to work doing this. seems i forgot to strip the decimals and round down the first time, but i stumbled across it the other day, and sicne you had given up on it i had forgotten it.

but thanks for the big step in the right direction.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Old 09-22-2006, 04:48 PM   #8 (permalink)
Major Leagues
 
Zubes's Avatar
 
Join Date: Sep 2005
Location: Chicago, IL
Posts: 361
Thanks: 0
Thanked 0x in 0 posts
converting height

big thanks to YoVivoPorSPORTS for intially starting to help me with this. no way i would have gotten this far without it.
__________________
Phil Zuber

Beyond the Ivy - Commish, Twins GM
Stars and Stripes Baseball League - Cubs GM
Bricks and Ivy - Orioles GM

Sim Coalition - co-founder

Zubes is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 02:38 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0
Copyright © 2009 Out of the Park Developments