I am trying to set the value of a field that has it’s name in a variable, without any success as of yet. I can’t seem to figure out how to do this. The name of my field is HP1R1Score. Here is what I have:
local HScorebox
HScorebox = “HP1R1Score”
field (HScorebox+"")
cell 0
It doesn’t put the 0 into that field and I can’t figure out why
I don’t see why what Jim gave doesn’t work for you. Here is a short animation showing your basic code with the removal of the +"" putting the 0 value in the proper field.
Jim’s procedure works for me as well, but I thought I would mention another way to do this.
local HScorebox
HScorebox = “HP1R1Score”
set HScorebox, 0
This sets the value of the field, but doesn’t make it the active field. You would still need the field command if you wanted to make it the active field.
It works if I make a new file with one field (HP1R1Score) and that short script.
I do need to figure out why my database won’t change the field in a script…
The field is "Number (Integer). I don’t think I have a variable by that name unless it was accidentally created along the way. I keep my variable names substantially different than my field names so as to avoid confusion and errors.
It’s always best to try to come up with the simplest code possible for debugging. The original code could be replaced with
HP1R1Score = 0
Does that work? Even if you ultimately really need the field name to be in a variable, trying this simple code verifies the basics before moving on to more complex applications.
I agree with the simple aspect. I do need to have the field name in a variable, and between “set” and “datavalue(” I think I have it now. I am slowly making sense of it all. I hate asking for help with simple/trivial issues but I only do that after an hour or so of looking for answers on my own. DNS outages don’t help, but I understand that s/>t happens. My personal knowledge base is rapidly expanding, in no small part due to this forum. Thank you all.