Using Variables in Field.Equation
Equipmentman1662
Forums
Good afternoon Brian,
Love the website, thanks for your dedication to it. I am trying to utilize a variable that I created from the Field Statistics to count the number of records. However when I put the variable in the Field.Equation line, I recieve a "0" instead of the number of records. The first attachment is the script piece, the second attachment is the results in the databas, where there are "0"s I was expecting the Recordnumber count from the variable RecordCounterResult.
Additional Info:
Test_1_Rank is a Character Field, thus the use of the @Val function.
Thanks for any insight.
Hi oyarzabalyago,
Hi oyarzabalyago,
You have to use a string variable to equal your equation. I am not sure if the highlighted part is your variable but I will assume it is so that code should look like this:
porcentage_activos = "@ABS((1 * " & num_activos & ")/100)"
field.Equation = porcentage_activos
Hopefully that will fix your problem.
You have to use a string variable to equal your equation. I am not sure if the highlighted part is your variable but I will assume it is so that code should look like this:
porcentage_activos = "@ABS((1 * " & num_activos & ")/100)"
field.Equation = porcentage_activos
Hopefully that will fix your problem.
Hi Equipmentman1662,
Hi Equipmentman1662,
I am glad you are enjoying the site.
A couple of things you need to change to make this work. First the InputBox returns a string and not an interger so change the RecordCounterResult to a string such as:
Dim RecordCounterResult as String
Next you need to modify your equation to:
"@val(@if(TEST_1_RANK="""", """ & RecordCounterResult & """, TEST_1_RANK))"
you need the ampersand (&) in order to concatenate a variable to a string. You also have to make sure there are three double quotes (") before and after the ampersand as you also need to place the RecordCounterResult between double quotes within the equation or you will get an error that your equation is incorrect.