INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Help running a script

Help running a script

(OP)
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.

RE: Help running a script

How about:

Update table1
Set TargetAlpha = '15@190'
Where SUBSTR(FormulaID, 1, 1) = 'E'
and
Update table1
Set TargetAlpha = '12@190'
Where SUBSTR(FormulaID, 1, 1) = 'H'

or
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 

Have fun.

---- Andy

There is a great need for a sarcasm font.

RE: Help running a script

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close