How can I convert all the distance data listed in miles to km?
Would I use a SQL query to convert it? What does everyone recommend?
73
KU3V
How to convert a large database with distance in mi to km?
- IW3HMH
- Site Admin
- Posts: 2926
- Joined: 21 Jan 2013, 14:20
- Location: Quarto d'Altino - Venezia (ITA)
- Contact:
Re: How to convert a large database with distance in mi to k
ADIF protocol stores data in KM. Log4OM provides a feature to show Miles instead of KM making a runtime conversion of the displayed data.
NOW, if you have data stored in MILES into the database you may want to convert them to KM (very strange but could happens...)
if you're able to work with SQL log4om provides a direct SQL input command to update your database directly:
This is useful if you're sure all distances are in Miles and you want to change them to KM.
The command is in the "QSO ARCHIVE" -> "FIELD UPDATE" in the box "Execute custom update query".
It works on the WHOLE database without regard of previous filters.
Another way:
If you want to make a full update of all SELECTED RECORDS (in the QSO Archive, before pressing "Field Update" button) you can use the massive update function [FIELD UPDATE in QSO Archive] (the same where you can type sql query directly in) and set the flag on "update QSO distance/bearing" then EXECUTE CHECKS button.
*MAKE A BACKUP of your data, as usually, before massive updates*
Here the code that will be executed (if you're interested in what program does with your data)
NOW, if you have data stored in MILES into the database you may want to convert them to KM (very strange but could happens...)
if you're able to work with SQL log4om provides a direct SQL input command to update your database directly:
Code: Select all
update log set distance = distance * <conversion factor>
The command is in the "QSO ARCHIVE" -> "FIELD UPDATE" in the box "Execute custom update query".
It works on the WHOLE database without regard of previous filters.
Another way:
If you want to make a full update of all SELECTED RECORDS (in the QSO Archive, before pressing "Field Update" button) you can use the massive update function [FIELD UPDATE in QSO Archive] (the same where you can type sql query directly in) and set the flag on "update QSO distance/bearing" then EXECUTE CHECKS button.
*MAKE A BACKUP of your data, as usually, before massive updates*
Here the code that will be executed (if you're interested in what program does with your data)
Code: Select all
try
{
string myGrid = qso.MyGridsquare;
string targetGrid = qso.Gridsquare;
if (string.IsNullOrEmpty(myGrid))
{
myGrid = Storage.TheUserConfiguration.My_gridsquare;
}
if (string.IsNullOrEmpty(targetGrid))
{
Country tempCountry = Storage.TheCountries.GetByDxcc(qso.Dxcc);
targetGrid = MaidenheadLocator.ObtainLocatorFromCountry(tempCountry);
}
if (string.IsNullOrEmpty(myGrid) == false && string.IsNullOrEmpty(targetGrid) == false)
{
qso.Distance = (int)MaidenheadLocator.Distance(myGrid, targetGrid);
qso.AntAz = (int)MaidenheadLocator.Azimuth(myGrid, targetGrid);
qso.Action = QsoAction.Update;
qso.Dirty = true;
}
}
catch
{
}
Daniele Pistollato - IW3HMH
- G4POP
- Log4OM Alpha Team
- Posts: 10803
- Joined: 21 Jan 2013, 14:55
- Location: Burnham on Crouch, Essex UK
Re: How to convert a large database with distance in mi to k
Actually its easyKU3V wrote:How can I convert all the distance data listed in miles to km?
Would I use a SQL query to convert it? What does everyone recommend?
73
KU3V
1. In the QSO archive manager highlight the QSO's which are in miles
2. In the field to update screen select "Update QSO distance and bearing"
3. Click on 'Execute checks'
4. Click OK
5. Close the update window
Job done
73 Terry G4POP
- IW3HMH
- Site Admin
- Posts: 2926
- Joined: 21 Jan 2013, 14:20
- Location: Quarto d'Altino - Venezia (ITA)
- Contact:
Re: How to convert a large database with distance in mi to k
pfff Terry... it's too easy!
Daniele Pistollato - IW3HMH
- G4POP
- Log4OM Alpha Team
- Posts: 10803
- Joined: 21 Jan 2013, 14:55
- Location: Burnham on Crouch, Essex UK
Re: How to convert a large database with distance in mi to k
IW3HMH wrote:pfff Terry... it's too easy!
Child's play
73 Terry G4POP
Re: How to convert a large database with distance in mi to k
Thanks! It worked. You are all helping to reduce my ignorance. Great program.
73
KU3V
Bill
73
KU3V
Bill