Hi all,
I'm very new to scripting, so I may be missing something obvious here - but I can't get functions to work where I've used "DIM" to assign a variable.
I have a test job where I am messing around with elbow throats - just trying to get comfortable with calling data and making changes, etc.
The elbows in my job all have a top extension of 6" and a bottom of 8"
The script as listed should change the bottom extension to 2". Running debug, everything looks like it should work, but upon running the script with no errors present, the values are not updated. I've inserted item.update() in various places with no success.
If I run the same script without defining variables and use item.dim#.value, everything works fine. It seems like there's a breakdown somewhere after "end function", but I can't figure it out. I've created many other practice scripts where assigning variables are not working for me, but long form always does.
I am hoping some of you would please point out where I am going astray!
I know that I don't necessarily need to make a function to accomplish this. I have written it long form and have accomplished the changes in just a few lines. I'm just playing around with different things, trying to get comfortable with writing scripts. I have relatively no experience with scripting or coding.
function ThroatSize()
dim top=item.dim[4].value
dim bottom=item.dim[5].value
debug top + " / " + bottom ---------> THIS REPORTS THE CORRECT INITIAL VALUE OF "6/8"
if top <=6 then
bottom = 2
endif
debug top + " / " + bottom ----------> THIS REPORTS THE CORRECT CHANGED VALUE OF "6/2"
end function
select item.cid
case 3
ThroatSize()
end select --------> DIMENSION 5, BOTTOM EXTENSION REMAINS UNCHANGED AT 8"