Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help running a script

Status
Not open for further replies.

nervous2

IS-IT--Management
Feb 24, 2003
125
CA
We recently moved to a new software at my office and some of the data didn't import fully. I want to manually fill in information but not sure the proper command.

Assuming this table is called (table1)

I want to change the TargetAlpha value based upon 2 rules

I want to say if "FOLMULAID" starts with E then "TargetAlpha" should be 15@190 for the "TestCode" Bake entry
yet if if "FOLMULAID" starts with H then "TargetAlpha" should be 12@190 for the "TestCode" Bake entry

FormulaID RevisionNo TestCode Testseq UsedAtSeq Inspection Measuring UpperValue LowerValue NormalValue TargetAlpha NumericTestResult

EA-0481-G 0000000001 Part.Size PTM08 3 S N 45 40 42.5 0
EA-0501-L 0000000001 Bake 2 S A 0 0 0 0
EA-0501-L 0000000001 Colour Da PTM03 6 S N 0.3 -0.3 0 0
EA-0501-L 0000000001 Colour Db PTM03 5 S N 0.3 -0.3 0 0
EA-0501-L 0000000001 Colour DL PTM03 7 S N 0.5 -0.5 0 0
EA-0501-L 0000000001 Colour Visual 4 S A 0 0 0 0
EA-0501-L 0000000001 Comments. 1 S A 0 0 0 0
EA-0501-L 0000000001 Film T. PTM 28 11 S N 3.5 1.5 2.5 0
EA-0501-L 0000000001 Gloss PTM01 10 S N 20 10 15 0
EA-0501-L 0000000001 Impact D. PTM05 9 S N 80 40 80 0
EA-0501-L 0000000001 Impact R. PTM05 8 S N 80 40 80 0
EA-0501-L 0000000001 Part.Size PTM08 3 S N 45 40 42.5 0
EA-0547-H 0000000001 Bake 10 S A 0 0 0 0
EA-0547-H 0000000001 Colour Da PTM03 6 S N 0.3 -0.3 0 0
EA-0547-H 0000000001 Colour Db PTM03 7 S N 0.3 -0.3 0 0
EA-0547-H 0000000001 Colour DL PTM03 5 S N 0.5 -0.5 0 0
EA-0547-H 0000000001 Colour Visual 8 S A 0 0 0 0
EA-0547-H 0000000001 Comments. 11 S A 0 0 0 0
EA-0547-H 0000000001 Film T. PTM 28 1 S N 3.5 1.5 2.5 0
EA-0547-H 0000000001 Gloss PTM01 2 S N 90 90 90 0
EA-0547-H 0000000001 Impact D. PTM05 3 S N 160 80 80 0
EA-0547-H 0000000001 Impact R. PTM05 4 S N 160 80 80 0
EA-0547-H 0000000001 Part.Size PTM08 9 S N 45 40 42.5 0
EA-0566-L 0000000001 Bake 2 S A 0 0 0 0
EA-0566-L 0000000001 Colour Da PTM03 6 S N 0.3 -0.3 0 0
EA-0566-L 0000000001 Colour Db PTM03 5 S N 0.3 -0.3 0 0

if anyone could help me with this I would very much appreciate it.
 
How about:
[tt]
Update table1
Set TargetAlpha = '15@190'
Where SUBSTR(FormulaID, 1, 1) = 'E'
[/tt] and [tt]
Update table1
Set TargetAlpha = '12@190'
Where SUBSTR(FormulaID, 1, 1) = 'H'
[/tt]
or
[pre]
Update table1
Set TargetAlpha = CASE WHEN SUBSTR(FormulaID, 1, 1) = 'E' THEN '15@190' END,
TargetAlpha = CASE WHEN SUBSTR(FormulaID, 1, 1) = 'H' THEN '12@190' END[/pre]

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Code:
Update table1
Set TargetAlpha = CASE WHEN LEFT(FormulaID, 1) = 'E' THEN '15@190'
                       WHEN LEFT(FormulaID, 1) = 'H' THEN '12@190' END 
WHERE LEFT(FormulaID, 1) IN ('E', 'H')

Borislav Borissov
VFP9 SP2, SQL Server
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top