Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need algorithm
Message
De
07/07/2011 10:31:53
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Games
Catégorie:
Question
Titre:
Divers
Thread ID:
01517506
Message ID:
01517585
Vues:
45
>What I don't understand is how do you go from bit to number that will be stored in the field. For example, say only the 1st option box is selected. Does it mean that the value of 1 is set to the field? And if Option 1 and 2 are selected, the value of 3 is set to the field? And in case of all three options boxes, the value is 7?

The options have numerical values 1, 2, and 4 assigned (for more than 3 options, use additional powers of 2: 8, 16, etc.). If one bit is set, add the values of the individual bits, e.g. 101(binary) = 4 + 1. To get the combined value:
CombinedValue = iif(CheckBox0.Value, 1, 0) + iif(CheckBox1.Value, 2, 0) + iif(CheckBox2.Value, 4, 0)
* (Assuming you changed the checkbox to a logical type. Otherwise, use iif(CheckBox.Value = 1...))
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform