33 Posts
justintime
5 years ago
Topic

I apologise for what may be to some seem a straightforward question; I am an enthusiastic amateur!

I am developing an application that when being configured on "day 0" offers a use the choice of rating the item in 2 or 3 dimensions (in a select field called dimension).  

Thereafter when the enduser creates an article on day 1+, if they have configured the application as 2 dimensions then only two rating fields will be offered (e.g. rating for probability and isotope) in the content form.  If it has been configured as 3 dimensions (probability, isotope and scent) then three rating fields are offered in the content form.  Each selection in the three fields is scored and multiplied out.  I was planning to use a conditional state on the scent field that if Dimension is set to 2 it is not visible (and has a default value of 0).

Thus far, I have created two categories called 2-dimension or 3-dimension with a parent category of "cat_dimension" and stored the value of the field Dimension (being the dynamic select value) in a separate table. This all works fine. Each article will have have a hidden field called dimensions that shows (another) category id = to the value contained in the field Dimension.  Is this the best way to achieve the result.  Each article already has a default category of "score".

My issue then becomes more computational in nature.  Is there a "relatively" simple way to attach a numeric value to the score arising from each dimension (each dimension is a dynamic select field); e.g. the scent scores would be strong, fragrant, light, weak (e.g. a scent score of strong=4, fragrant=3, etc).  I know that this can be done with select simple fields but I need to use dynamic select to allow the client the ability to define their own scoring system.  I then need to create a field which multiplies out the three scores to generate a result.  

Thank you in advance for any help you can provide.

Get a Book for SEBLOD
4229 Posts
Kadministrator
5 years ago
0
Level 1

I think this is doable with computation if  your select fields would use numeric values as field value, than you could simply multiply or sum this values into result field.

4229 Posts
Kadministrator
4 years ago
0
Level 1

In any select you can use words for text and numbers for value, in select dynamic this is done as 

SELECT someColumn AS text, someOtherColumn AS value FROM #__mytable

Get a Book for SEBLOD