Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] DECIMAL table field not correclty created in DB

DECIMAL table field not correclty created in DB 31 Jan 2013 07:46 #6579

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
BUILDER: if I create a field DECIMAL and then in the validation rule I make for example a rule to have a value like:

decimal (11, 7)

the validation rule works perfectly, BUT the value is not stored correctly in the DB, because the SQL code to create that field at the installation process of the component, is wrong.
It still create a field:

decimal (10, 2)
The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 09:07 #6585

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
When you create the decimal field type, are you also adding in the precision and scale to the field properties on the table?

I've done this with no problem at all previously with height, width, price and percentage type data combined with a custom regex validation too.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 10:26 #6587

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Hi, thanks for the reply.
where should be the option?, I didn't find it any other options except these:

The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 12:11 #6590

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @Tomaselli,

When you add the field to the table, select the decimal data type then you'll see precision/scale input properties on the field underneath the required, unique etc...

Then, when you type into precision/scale, a rule/handler will be created. You can and probably should override the handler and regex with your custom validation.

Hope it helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
The following user(s) said Thank You: Tomaselli

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 12:23 #6595

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
thanks, I found it, the problem was because I created the table field from the FLOAT instead to use the DECIMAL, even if at the end....the final field table type it's the same.
The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 12:31 #6596

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
but it shouldn't be like that.
The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 12:41 #6597

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Tomaselli wrote:
but it shouldn't be like that.
what do you mean - that it shouldn't be storing it as a float when decimal fieldtype is set?
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 13:48 #6598

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
At the beginning I selected a FLOAT type, then I modify the validation rule, to work as a decimal (11, 7).
I saw on the SQL file generated, it was generated a decimal (10,2), so I thought the jcook builder recognized my will :) and it generated a decimal field, but the precision, scale was wrong.

So I made the post.

Then you pointed me to the fact I did a mistake chosing the FLOAT, but I should have choosen a DECIMAL type, otherwise the precision, scale options will not appear.

so my thoughts are:

1) if the jcook generated a decimal field instead of the initial float field, why didn't jcook generate a correct precision, scale (decimal(11,7))?

2) IF jcook wasn't supposted to generate a decimal field from an initially choosen FLOAT field type, why did it generate a decimal?


I hope my explanation is enough understandable. :)
I found out, it was my mistake! :-) the Jcook is working correctly on the table field creation. I just exchanged the files I was comparing. I apologize.
Last Edit: 31 Jan 2013 19:56 by Tomaselli. Reason: I added some notes, to avoid confusion to the jcook community
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: DECIMAL table field not correclty created in DB 31 Jan 2013 21:19 #6601

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @Tomaselli,
Don't apologise! All feedback - whether they turn out to be issues, or not - are really helpful in identifying areas of the ever-evolving interface that could be further explained and/or documented.

As always, your input is always valued!

Thanks,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.
Time to create page: 0.070 seconds

Get Started