This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
17 Posts
justintime
5 months 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 months ago
1
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.

17 Posts
justintime
5 months ago
0
Level 2

The dynamic select has to use words.  When the entries for dynamic select are created, a numeric "ranking" is created at the same time.  Somehow I need to use the "ranking" as the values used in the computation.

I have run into a bigger problem in the first stage however.  When we stipulate the number of dimensions, that has to act as a global value across the application.  To make the conditionality work, I need to include the field "Dimension" in the form.  But this means it is expecting a value to be selected each time the form is created rather than using the "global" value.  Is there a means to force the default to be a global value?

Just been trying to read around the issue.  If I created a user with an ID=999, and pre-populated that used with a Dimension value, can that value be called from any form/content type and used as the default value in a field in the form/content type?  I get the concept by no idea how to deliver.

Thank you in advance for your input.

4229 Posts
Kadministrator
5 months ago
1
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

17 Posts
justintime
5 months ago
0
Level 2

Thank you. So,.. where does this fit into the field definition form used to define fields.  I attach an image but the system keeps telling me that a jpg and png are illegal extensions.

Get a Book for SEBLOD