Forum: Forums topas RSS
Issues with conditional modification of a variable using IF
Henrik #1
User title: XRD Application Specialist
Member since Jan 2020 · 3 posts · Location: Denmark
Group memberships: Members
Show profile · Link to this post
Subject: Issues with conditional modification of a variable using IF
I Have tried to conditionally adjust a parameter depending on its value using IF, but I always get an error, probably the syntax is wrong but it would be great if someone could point me in the right direction. Please see my attempt below:
I am trying to adjust the "total" amount conditionally if the value of total is  >1.

prm total = ((wp_phase1) + (wp_phase2)); :  0

If(total>1, prm total_adjusted = (total * 0.8);:0, prm total_adjusted = total ;:0);
johnsoevans (Administrator) #2
User title: John Evans
Member since Aug 2009 · 246 posts
Group memberships: Administrators, Members
Show profile · Link to this post
I haven't looked at your specific example in detail.  I find the best way to learn/remember topas syntax is to look in "topas.inc" which contains 2500 lines of topas macros.  There's normally a similar example, and it's often easier to find things than in "tech ref".  It's in the main topas directory or via Topas_Durham_Menus/Help/Alans macros if you use jEdit.  Just be careful not to change the file when you read it (perhaps make yourself a backup copy).

There are 21 "If(" statements in there.

jEdit tip: highlight the text you're interested in the hit alt-fullstop.
Henrik #3
User title: XRD Application Specialist
Member since Jan 2020 · 3 posts · Location: Denmark
Group memberships: Members
Show profile · Link to this post
Thank you for pointing me in the right direction. This syntax worked:

prm total = ((wp_phase1) + (wp_phase2)); :0
prm total_adjusted = If(total>1, total * 0.8, total); :0
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Not logged in. · Lost password · Register
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-11-29, 14:36:20 (UTC +00:00)