Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Auto action to store a value into DB using code action

11 years 6 months ago - 11 years 6 months ago #225285 by deltafidesign
I have a drop down field that contains city values

Some of those cities names are something like "Pomigliano d'Arco".

I need to convert those cities names in a SEF way like "pomigliano-d-arco". I need that 'cause I use another auto action to redirect to a GJ group where the redirect link is www.mysite.com/ [city]

Now if I use [city] as substitution I have a link like this: www.mysite.com/Pomigliano d'Arco instead of www.mysite.com/pomigliano-d-arco

Is there a way to do this? Maybe with another auto-action code that convert the [city] value in a SEF way and then store it into another cb field ?

Thanks
Last edit: 11 years 6 months ago by deltafidesign. Reason: Solved

Please Log in or Create an account to join the conversation.

11 years 6 months ago #225357 by deltafidesign
Replied by deltafidesign on topic Auto action to store a value into DB using code action
Up to previous post, can I use a cb query field to convert city field valued in a SEF way?

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
11 years 6 months ago #225360 by krileon
Yes, use CB Query Field to query the database for the field then you can use SQL functions to format it however you need.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

11 years 6 months ago - 11 years 6 months ago #225384 by deltafidesign
Replied by deltafidesign on topic Auto action to store a value into DB using code action
I've creted the CB query field and it seems work fine but I can't transform to lowercase words. I've used this statement:
Code:
SELECT LOWER ( REPLACE ( REPLACE ( REPLACE (`cb_city`, '\' ', '-' ), '\'', '-'), ' ', '-' ) ) FROM `jos_comprofiler` WHERE `user_id` = '[user_id]'

If I do not use LOWER ( .... ) everything works fine. How can I lowercase all words in this expression?
Last edit: 11 years 6 months ago by deltafidesign.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
11 years 6 months ago #225403 by krileon
Enable debug mode and maximum error reporting in Joomla global configuration then view anywhere the field is displayed to see if a fatal SQL error is present.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

11 years 6 months ago - 11 years 6 months ago #225407 by deltafidesign
Replied by deltafidesign on topic Auto action to store a value into DB using code action
I got this error 1305:

FUNCTION mydbname.LOWER does not exist SQL=SELECT LOWER ( REPLACE ( REPLACE ( REPLACE (`cb_city`, '\' ', '-' ), '\'', '-'), ' ', '-' ) ) FROM `jos_comprofiler` WHERE `user_id` = '885'

ADD

Now I got this error 1064:

1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT LOWER ( REPLACE ( REPLACE ( REPLACE (`cb_city`, '\' ', '-' ), '\'', '-'' at line 1 SQL=SELECT SELECT LOWER ( REPLACE ( REPLACE ( REPLACE (`cb_city`, '\' ', '-' ), '\'', '-'), ' ', '-' ) ) FROM `jos_comprofiler` WHERE `user_id` = '885'
Last edit: 11 years 6 months ago by deltafidesign.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum