OptionSets of type Number - is optionvalue CODES then limited to number?

Hi

I am uncertain if this is a bug or not (latest build 2.26):

When you define an option set using valueType=Number, the system will only accept optionValue codes consisting of digits (no letters) for that optionSet.

There is no mention of this restriction in the user manual.

Is this intended behaviour, or is it a bug?

Regards
Calle

···

Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi again,

Just to add: the constraint that optionSets with valueType = Number can only have optionValue codes consisting of digits is new in either 2.25 and/or 2.26 - it is not there in 2.24.

Which is why I suspect this might be a bug - but I would like confirmation before reporting it on JIRA

Best regards

Calle

···

On 11 February 2017 at 13:21, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi

I am uncertain if this is a bug or not (latest build 2.26):

When you define an option set using valueType=Number, the system will only accept optionValue codes consisting of digits (no letters) for that optionSet.

There is no mention of this restriction in the user manual.

Is this intended behaviour, or is it a bug?

Regards
Calle


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi Calle,

the value type of option sets do refer to the codes of the options within the option set.

In the data entry apps, for data elements with option sets, we do store the codes of the options (not the name) in the database. Also, the value type of the data element is inherited from its option set. This ensures that the data values stored for a data element matches the value type of the data element (and its option set).

Lars

···

On Sat, Feb 11, 2017 at 12:40 PM, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi again,

Just to add: the constraint that optionSets with valueType = Number can only have optionValue codes consisting of digits is new in either 2.25 and/or 2.26 - it is not there in 2.24.

Which is why I suspect this might be a bug - but I would like confirmation before reporting it on JIRA

Best regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On 11 February 2017 at 13:21, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi

I am uncertain if this is a bug or not (latest build 2.26):

When you define an option set using valueType=Number, the system will only accept optionValue codes consisting of digits (no letters) for that optionSet.

There is no mention of this restriction in the user manual.

Is this intended behaviour, or is it a bug?

Regards
Calle


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Hi Calle - the data type of the option set is meant to dictate what type of data the option set codes will be. I would say the error was in 2.24 and older dhis versions - allowing letters in codes for numeric option sets seems like a bug.

Markus

···

Den 11. feb. 2017 kl. 12.40 skrev Calle Hedberg calle.hedberg@gmail.com:

Hi again,

Just to add: the constraint that optionSets with valueType = Number can only have optionValue codes consisting of digits is new in either 2.25 and/or 2.26 - it is not there in 2.24.

Which is why I suspect this might be a bug - but I would like confirmation before reporting it on JIRA

Best regards

Calle

On 11 February 2017 at 13:21, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi

I am uncertain if this is a bug or not (latest build 2.26):

When you define an option set using valueType=Number, the system will only accept optionValue codes consisting of digits (no letters) for that optionSet.

There is no mention of this restriction in the user manual.

Is this intended behaviour, or is it a bug?

Regards
Calle


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

Lars/Markus,

Thanks for the clarification - I had interpreted the valueType as controlling the optionvalue NAME and not the CODE. And the difference with pre-2.25 versions were confusing.

My only concern then is the demand for uniqueness across option sets - from the 2.26 User Manual:

“Option sets must have a code as well as a name. You can change the names but you can’t change the codes. Both names and codes of all options must be unique, even across different option sets.”

This means that you cannot have more than one optionSet using valueType number and then using any number already used by another option set - or in other words, you cannot have one numeric option set with options 1,2,3 and another numeric option set with options 1,2,3,4,5

I’ve had no problems creating different TEXT option sets with identical values, though: For instance, I’ve got one option set with “Yes, No, Unknown” and another with “Yes, No, Unknown, Not applicable”. They work fine…

Regards

Calle

···

On 11 February 2017 at 15:27, Markus Bekken markus@dhis2.org wrote:

Hi Calle - the data type of the option set is meant to dictate what type of data the option set codes will be. I would say the error was in 2.24 and older dhis versions - allowing letters in codes for numeric option sets seems like a bug.

Markus

Den 11. feb. 2017 kl. 12.40 skrev Calle Hedberg calle.hedberg@gmail.com:

Hi again,

Just to add: the constraint that optionSets with valueType = Number can only have optionValue codes consisting of digits is new in either 2.25 and/or 2.26 - it is not there in 2.24.

Which is why I suspect this might be a bug - but I would like confirmation before reporting it on JIRA

Best regards

Calle


Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

On 11 February 2017 at 13:21, Calle Hedberg calle.hedberg@gmail.com wrote:

Hi

I am uncertain if this is a bug or not (latest build 2.26):

When you define an option set using valueType=Number, the system will only accept optionValue codes consisting of digits (no letters) for that optionSet.

There is no mention of this restriction in the user manual.

Is this intended behaviour, or is it a bug?

Regards
Calle


Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg



Calle Hedberg

46D Alma Road, 7700 Rosebank, SOUTH AFRICA

Tel/fax (home): +27-21-685-6472

Cell: +27-82-853-5352

Iridium SatPhone: +8816-315-19119

Email: calle.hedberg@gmail.com

Skype: calle_hedberg


Hi, I realize this is a very old discussion, but I’m trying to figure out - should the value type for a data element with an option set match the value type of the option set (so if the code is a number, the data element value type will be number), or should it always be text for an option set? I think I (accidentally) have done it both ways but wanted to see what you all think.

Hei @Natalie_Tibbels !
The data type of the data element will follow the data type for the CODE of the option set. This will(should) happen automatically as you assign an option set to a data element.

If the option set codes are yes/no, the data element must have data type yes/no as well.

Markus

1 Like

Sorry for taking 4 years to reply - but this seems like an error in the docs @Calle_Hedberg :slight_smile: The number 10 might be used in several different option sets. The uniqueness in only enforced within each option set, changing the docs now.

Markus

Hi @Markus,

I have one case:

In my tracker, I have one data element of text data type which has an option set to it, but the options codes in the option set are numbers. See image

Is this invalid in the DHIS 2? Or I might have misunderstood your post.

Thanks

Hey @ferdinandmussavene - what is the data type for the option set? Even if your options are numbers, the data type might be text - as text will allow both numbers and letters.

1 Like

Hi @Markus,

The data type of the option set is text.

Thanks

1 Like

Yeah, so we see ‘1’ and ‘0’ but it might not necessarily be a ‘number’ data type rather it could simply be text. If data type is crucial wouldn’t it be better if a string literal is added for text? :smiley: Thanks!