The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 simple (?) Problem with if/else syntax
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hesaboogie

12 Posts

Posted - 03/01/2012 :  10:38:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6
Operating System: WinXP

hi,
i'm new to labtalk etc. so i think the solution to my problem is probably very easy, but i read through the labtalk help and it still won't work.

I want to calculate values (density) in a column depending on the existing of a value in another column (volume). If the sample is a cylinder, i can calculate the density with the mass, diameter and length and the volume column is empty. If not, i can calculate the density by mass/volume. So i tried the "Set values" dialog and put this in the script window:


range rvolume = Col(AE);
range rmass = Col(AA);
range rdiameter = Col(AC);
range rlength = Col(AD);

rcylinder = (rmass / ((rdiameter / 2 ) ^ 2 * pi * rlength * 1000000);
rother = rvolume / rmass * 1000;

if (rvolume > 0) rrho = rother;
else rrho = rcylinder;


then i type "rrho" in the column formula panel, but nothing happens and i don't know why.
What do i do wrong?

thanks,
theresa.

greg

USA
1378 Posts

Posted - 03/01/2012 :  10:59:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is a parentheses parity problem with the expression

rcylinder = (rmass / ((rdiameter / 2 ) ^ 2 * pi * rlength * 1000000);

Fix that and you should be all set.
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 03/01/2012 :  11:09:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
After you have your script debugged, check your equations. I think rother should equal rmass/rvolume *1000000.
Go to Top of Page

hesaboogie

12 Posts

Posted - 03/01/2012 :  11:15:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for your answer, i didn't expect the solution to be that easy! ;-)
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000