Jump to content
  • 0
jupeto

Character array variable

Question

I don't know if I'm doing this right

 

So I have a collection of character variable like so;

 

variable_one[0] = value_one
variable_two[0] = value_two
variable_three[0] = value_three

 

then I'm trying to push some data to it

 

variable_one[getarraysize(variable_one)] = value_one_point_one
variable_two[getarraysize(variable_two)] = value_two_point_one
variable_three[getarraysize(variable_three)] = value_three_point_one

 

I can see that it saves to my database 

 

but when I try to access it and loop like this



for (.@i = 0; .@i < getarraysize(variable_one); .@i++) {
    mes variable_one[.@i];
}
end;

 

 

 

the result is only one value

Edited by jupeto

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

.@i < getarraysize(variable_one)

 

You want to review the control part of your FOR loop.

 

 

 

You also, may want to review the overall logic of your code...

I don't have time right now to go over Hercules's scripting Syntax and see how arrays are built there.

 

But, there is something about your code, that confuses me...

Edited by Habilis

Share this post


Link to post
Share on other sites
  • 0

variable_one[getarraysize(variable_one)] = value_one_point_one
variable_two[getarraysize(variable_two)] = value_two_point_one
variable_three[getarraysize(variable_three)] = value_three_point_one

 

I think you need these the other way around? E.g.

 

JobLevel = .@joblevel;

 

Would make your JobLevel = whatever .@joblevel is.

So when saving

 

variable_one[getarraysize(variable_one)] = value_one_point_one

v1[3] would mean whatever the third index of variable one is, is now equal to value point 1.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.