Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

If condition error for Alchemer survey custom script for calculation

markalva10

New Coder
Hey all,

I am trying to code for a custom carbon footprint calculator based off the Alchemer survey software. I am running into an error of ')' expected next to = in my initial 'if' callout and am also unsure about the initial establishment of my variables.

The numbers in (10040), (10041), (10042), etc. all indicate specific choices within my survey.

Any advice is much appreciated.

Code:
<
vehicle1gasoline = (10040)
vehicle1diesel = (10041)
vehicle1electric = (10042)
vehicle1hybrid = (10043)

vehicle1lightuse = (10044)
vehicle1moderateuse = (10045)
vehicle1heavyuse = (10046)

vehicle2gasoline = (10047)
vehicle2diesel = (10048)
vehicle2electric = (10049)
vehicle2hybrid = (10050)

vehicle2lightuse = (10051)
vehicle2moderateuse = (10052)
vehicle2heavyuse = (10053)


if (vehicle1gasoline == (10040)  and vehicle1lightuse = (10044) and vehicle2gasoline = (10047) and vehicle2lightuse = (10051)) then

totalannualmiles == 10000
milespergallon == 22
numberofvehicles = getvalue (2)
emissionfactor == 8.8
 
publictransittrips = getvalue (24)
averagetransittrip == 5
transitemissionfactor == .19

shorthaultrips = getvalue (25)
averageshorthaul == 287
shorthaulemissionfactor ==.276

longhaultrips = getvalue (26)
averagelonghaul == 700
longhaulemissionfactor == .182
 
totalemissions = (((totalannualmiles / milespergallon) * emissionfactor * numberofvehicles) + (publictransittrips * averagetransittrip * transitemissionfactor) + (shorthaultrips * averageshorthaul * shorthaulemissionfactor) + (longhaultrips * averagelonghaul * longhaulemissionfactor))
  setvalue(52,totalemissions)
end
>
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom