Due to enormous amounts of spam, the forum has been set to read-only mode.



Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
StampCAT: relocate data between fields 
Author Message

Joined: Sun Feb 13, 2005 7:47 pm
Posts: 100
Location: Mo i Rana, Norway
Post StampCAT: relocate data between fields

For my domicile collection I have used the Perforation field to store the dimensions for the objects.
Dimensions are stored as Height by Width (don't ask why) and in millimeter measurements, i.e. 89x103 or 130x180.

Are there any way to get the dimensions over from "Perforation_horiz" field to the new "Height" and "Width" fields by SQL statements?
And if so how to do it?
If not, are there any other solutions except manually? Can I export to Excel forth and back?

I've got more than 2800 object registered in the database and hope to find an easy way to solve this task.

_________________
Windows 7 Pro 32bit
StampCAT 10.20
CATraxx 9.40
BookCAT 10.20
AssetCAT 1.10


Wed Oct 26, 2011 6:52 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Nov 22, 2002 3:52 pm
Posts: 13748
Post Re: StampCAT: relocate data between fields

Johnny T wrote:
For my domicile collection I have used the Perforation field to store the dimensions for the objects.
Dimensions are stored as Height by Width (don't ask why) and in millimeter measurements, i.e. 89x103 or 130x180.

Are there any way to get the dimensions over from "Perforation_horiz" field to the new "Height" and "Width" fields by SQL statements?
And if so how to do it?

1. Backup your database!

2. Download and run http://www.fnprg.com/dl/sqlupdate.exe

3. Click ... and select your database file.

4. Run this SQL update query:

Code:
UPDATE Stamp, Perforation, Stamp INNER JOIN Perforation ON Stamp.Perforation_HorizID = Perforation.PerforationID
SET Height = LEFT(Perforation.Perforation, INSTR(Perforation.Perforation, 'x') - 1), Width = MID(Perforation.Perforation, INSTR(Perforation.Perforation, 'x') + 1)


5. To clear the Perforation Horiz field, run this SQL update query:

Code:
UPDATE Stamp SET Perforation_HorizID = -1


6. And finally, to empty the Performation table:

Code:
DELETE * FROM Perforation

_________________
Fredrik Nordbakke
www.fnprg.com


Thu Oct 27, 2011 12:03 pm
Profile WWW

Joined: Sat Oct 29, 2005 6:29 pm
Posts: 40
Location: Netherlands
Post Re: StampCAT: relocate data between fields

Hello Frederik,

I have almost the same problem with the perforation-field.
I entered the following values:
'Kamtanding 13½:14½'
'Lijntanding 13½:15½'
and
'Boven, links en onder ongetand'

Now I have to spilt this values in 13½,14½ and 13½,15½
In the third case, without ':', I want to store the values in the field Custom 08.

How do have to change the query?

With kind regards,
Ronald de Waal

_________________
With kind regards,
Ronald de Waal


Last edited by Ronald de Waal on Fri Oct 28, 2011 8:42 am, edited 2 times in total.



Thu Oct 27, 2011 12:42 pm
Profile WWW

Joined: Sun Feb 13, 2005 7:47 pm
Posts: 100
Location: Mo i Rana, Norway
Post Re: StampCAT: relocate data between fields

Hi Fredrik!
Thank you for your time!
Unfortunately this SQL code resulted in a error.

Code:
UPDATE Stamp, Perforation, Stamp INNER JOIN Perforation ON Stamp.Perforation_HorizID = Perforation.PerforationID
SET Height = LEFT(Perforation.Perforation, INSTR(Perforation.Perforation, 'x') - 1), Width = MID(Perforation.Perforation, INSTR(Perforation.Perforation, 'x') + 1)


Below I have attached a partly screen shot from my Perforation table and the error message itself, I hope this is enough to troubleshoot the error in executing the SQL code.

Image

And the error message:

Image

Problem mixing Text and Number??

_________________
Windows 7 Pro 32bit
StampCAT 10.20
CATraxx 9.40
BookCAT 10.20
AssetCAT 1.10


Thu Oct 27, 2011 3:05 pm
Profile WWW

Joined: Sun Feb 13, 2005 7:47 pm
Posts: 100
Location: Mo i Rana, Norway
Post Re: StampCAT: relocate data between fields

Hm!

Leaving out the second part of the sql statement ", Width = MID(Perforation.Perforation, INSTR(Perforation.Perforation, 'x') + 1)" resulting in a successful copying to the "Heigth" field.

Running the sql code with above statement alone, resulting in error "ikke samsvar mellom datatyper i vilkårsuttrykk (not consistent between data types in terms of expression)"
Any ideas why?

_________________
Windows 7 Pro 32bit
StampCAT 10.20
CATraxx 9.40
BookCAT 10.20
AssetCAT 1.10


Thu Oct 27, 2011 7:56 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Nov 22, 2002 3:52 pm
Posts: 13748
Post Re: StampCAT: relocate data between fields

Johnny T wrote:
Problem mixing Text and Number??

Most likely. Do any of the entries in the Perforation table contain anything else than a number after the "x" (comma, letters, etc.)?

_________________
Fredrik Nordbakke
www.fnprg.com


Fri Oct 28, 2011 10:14 am
Profile WWW
Site Admin
User avatar

Joined: Fri Nov 22, 2002 3:52 pm
Posts: 13748
Post Re: StampCAT: relocate data between fields

Ronald de Waal wrote:
Hello Frederik,

I have almost the same problem with the perforation-field.
I entered the following values:
'Kamtanding 13½:14½'
'Lijntanding 13½:15½'
and
'Boven, links en onder ongetand'

Now I have to spilt this values in 13½,14½ and 13½,15½
In the third case, without ':', I want to store the values in the field Custom 08.

How do have to change the query?

It isn't really possible to use a sql update query here since you want to transfer the data to a lookup field.

_________________
Fredrik Nordbakke
www.fnprg.com


Fri Oct 28, 2011 11:00 am
Profile WWW

Joined: Sat Oct 29, 2005 6:29 pm
Posts: 40
Location: Netherlands
Post Re: StampCAT: relocate data between fields

FredrikN wrote:
Ronald de Waal wrote:
It isn't really possible to use a sql update query here since you want to transfer the data to a lookup field.


Hello Frederik,

I shell try to transfer the data with a VB-routine. Thanks.

With kind regards,
Ronald de Waal

_________________
With kind regards,
Ronald de Waal


Fri Oct 28, 2011 12:55 pm
Profile WWW

Joined: Sun Feb 13, 2005 7:47 pm
Posts: 100
Location: Mo i Rana, Norway
Post Re: StampCAT: relocate data between fields

FredrikN wrote:
Johnny T wrote:
Problem mixing Text and Number??

Most likely. Do any of the entries in the Perforation table contain anything else than a number after the "x" (comma, letters, etc.)?


Yes, you are right again!
I have overlooked that record 241 contained two x's.
Once I removed one of the x's, then the sql code ran well.

Case solved!
Thank you!

_________________
Windows 7 Pro 32bit
StampCAT 10.20
CATraxx 9.40
BookCAT 10.20
AssetCAT 1.10


Fri Oct 28, 2011 2:12 pm
Profile WWW

Joined: Sun Feb 13, 2005 7:47 pm
Posts: 100
Location: Mo i Rana, Norway
Post Re: StampCAT: relocate data between fields

Ronald de Waal wrote:

I shell try to transfer the data with a VB-routine. Thanks.



Please report back if you succeed, maybe I to will have a try!

_________________
Windows 7 Pro 32bit
StampCAT 10.20
CATraxx 9.40
BookCAT 10.20
AssetCAT 1.10


Fri Oct 28, 2011 4:57 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ]  Go to page 1, 2  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.