Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functions with attribute index #619

Open
phtj opened this issue Nov 5, 2019 · 2 comments
Open

functions with attribute index #619

phtj opened this issue Nov 5, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@phtj
Copy link
Contributor

phtj commented Nov 5, 2019

For functions with attrib index, the index is only used for attributes that are lists
Its is quite annoying because it is often null

Instead, we can use an attribute name with index included as part of the string

For example

attrib.Set(my_posis, "xyz[2]", 123)

instead of

attrib.Set(my_posis, "xyz", 2, 123)

@phtj phtj added the enhancement New feature or request label Nov 5, 2019
@phtj phtj self-assigned this Nov 5, 2019
@phuongtung1
Copy link
Contributor

i think this might not be possible, since the index could be a variable. So if we want to set xyz[i], the string would be "xyz[i]" which is not possible to solve in the modeling function since the value of i is not passed in

@phtj
Copy link
Contributor Author

phtj commented Nov 11, 2019

We can use an array instead, where the first item is the attrib name and the second is the attrib index. But in cases where there is no name, we just pass a string (no array).

For example

attrib.Set(my_posis, ["xyz", 2], 123)

instead of

attrib.Set(my_posis, "xyz", 2, 123)

The reason for this is that most of the time, there is no index, so we can do

attrib.Set(my_posis, "my_attrib", 123)

instead of

attrib.Set(my_posis, "my_attrib", null, 123)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants