International phone number CB Field group

5 months 3 weeks ago #334994 by activha
Replied by activha on topic International phone number CB Field group
I need to access the record from a node.js application to retrieve the phone number with a SQL like
      const [rowsMsisdn]: [RowDataPacket[], FieldPacket[]] = await connection.execute(
        'SELECT * FROM `yq0g1_comprofiler` WHERE `cb_mobile` = ?',
        [msisdn]
      );

So it would be best to have the phone number without spaces or + sign

Please Log in to join the conversation.

5 months 3 weeks ago #334996 by krileon
Replied by krileon on topic International phone number CB Field group
You've a couple of options in that case. Below are a few I can think of off the top of my head.

You could do as suggested in my last reply and use an integer field to store it or a text field with validation only accepting integers then format its display using a code field so you can use PHP to format it however you want.

You could also just improve your SQL to do a REPLACE and replace any invalid characters on `cb_mobile` then use text field with input mapping.

You could use a text field with input mapping then on profile save push it to a separate integer field with the formatting removed, but this will result in double storage.


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 to join the conversation.

5 months 3 weeks ago #334998 by activha
Replied by activha on topic International phone number CB Field group
You mean that something like this would suffice ?
const cleanedSQL = "REPLACE(REPLACE(REPLACE(`cb_mobile`, '+', ''), '(', ''), ')', '')"; const [rowsMsisdn]: [RowDataPacket[], FieldPacket[]] = await connection.execute( `SELECT * FROM \`yq0g1_comprofiler\` WHERE ${cleanedSQL} = ?`, [msisdn] );
Then I can use a text field with input mapping and avoid validation ??

Please Log in to join the conversation.

5 months 3 weeks ago #334999 by krileon
Replied by krileon on topic International phone number CB Field group
Yes, but you should check the performance of that query first. You probably will want to add a index for that column to CBs table as well. Depending on MySQL version you can probably use REGEX_REPLACE to simplify that further.


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.
The following user(s) said Thank You: activha

Please Log in to join the conversation.

5 months 3 weeks ago #335000 by activha
Replied by activha on topic International phone number CB Field group
Thanks a lot ! 
Will have to update mariaDB but REGEX_REPLACE is a great idea :-)

Now I am going to try to register an unexisting user to joomla through node.js. I guess I can do it directly through DB ?

Please Log in to join the conversation.

5 months 3 weeks ago #335002 by krileon
Replied by krileon on topic International phone number CB Field group

 Now I am going to try to register an unexisting user to joomla through node.js. I guess I can do it directly through DB ?

I doubt it as you wouldn't be able to generate the password matching Joomla's hashing. The easiest way to create users externally is to either use Joomla 4 built in API with authentication token (this will only create the Joomla user and not CB user though) or create an auto action to create users then HTTP call the auto action from node.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.191 seconds

Facebook Twitter LinkedIn