Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Popular Posts

Tags

2008 2008 Express Add AFTER alert Alias Aliases Alter Alternating And ASC Assist BETA Blog Cancel Check ON Checkbox Checkbox Group Color Column Columns Combo Box Composite Confirm Confirm Message Control CREATE CREATE TABLE Data Data Springs Database DDL DELETE Delete Confirm Demo Demonstration DESC Direct Access DNN DotNetNuke Drop Drop Constratint Drop Down Drop Down List DS Dynamic Dynamic Blog Dynamic Forms Dynamic Registration Dynamic Views Edit Event Example Express Fade In Fade Out Field Filters FK Forms Full-Table Scan Generating Generator Generators Great Ideas Group Help HTML Increase Index Indexes Input Integrity jQuery Label Listbox Listener Message Modify My Account MySQL No NULL Often Ok ON Optimization Optimize Option Options Oracle Order By Perform Performance PK Popup PostreSQL Queries Query QuestionOptionValue Radio Button Radio Button Group References referential Round Script Search Search Filters SearchOption SearchOptionValue Select Server Snippet Sort Springs SQL SQL Driven SQL Driven Query SQL Express SQL Server SQL Server 2005 SQL Server 2008 SQL Server 2008 Express SQL Server 2008 R2 SQL Server Express SSMS Stored Stored Procedure TABLE Tables Temporary Tool Tools Tooltip Tooltips Transact-SQL Trials Triggers TSQL T-SQL Unique UPDATE Use Useful Views Widget Widgets Window Yes [userimage] 10 64 bit Ability ABS Action Active Forums Alleviate Alternating Colors Alternating Rows Analytics ARB asp.net asp.net validation AuthARB Authorize.NET Avoid Back Button Basecamp Blog Blog Posts Blogging Browser Browser Back Browser Close Browser History Browser Script Button cascading style sheet Case Char Character CharAt CharAt() Check chip levinson Click client side validation Close Browser Close Window Collection 5.0 Comment Compatibility Compatible Completion completion event Confirm Message Conform Constraints content localization Count Timer Countdown CRM css csv Cursor Custom Custom HTML Custom JavaScript Custom JavaScript File customer feedback Customize Data Data Integrity Data Springs Data Springs Blog Data Springs Collection Data Springs Development Data Springs Planning Data Springs Training Databases DataSprings Date Time JavaScript Debug Info default value Delete Demonstration DF DNN DNN Authentication DNN Blog DNN Core Profile Property dnn html module dnn modules dnn schedule error dnn schedule multiple DNN Store document document.getElementById DotNetNuke dotnetnuke 5.4.4 DotNetNuke Analytics DotNetNuke Forums DotNetNuke JavaScript DotNetNuke Modules dotnetnuke reporting dotnetnuke scheduler dotnetnuke user image Double Double Quotes DR DROP Drop Constraint DropDown Login DS dynamic Dynamic Data dynamic fields Dynamic Form Dynamic Forms dynamic forms silent post Dynamic Forms Tutorial dynamic login Dynamic PDF Form Completion Event dynamic registration dynamic registration silent post dynamic registration user image dynamic user directory dynamic views DynamicRegistration_Question DynamicRegistration_QuestionResponse email email issues Encapsulated Encapsulation Even Event Event Viewer Example Excel Execute Export Export to Excel Facebook Facebook Connect Field FieldID First FirstName Fix Foreign Key Form Form Post Formatting Forms Forum Flow Full Table Scan Fully Function Google Analytics Google Analytics Ecommerce Great Great ideas Grid guides hidden field Hide Show Rows Highrise Highrise API Hourly Services HTML HTTP Post iDeal IE IE 10 Image Image Button Include Inconsistancy Info Information Injection INSERT Integration Interactive User Import Interface internet Internet Explorer iPAD iPAD App for Highrise iPAD Highrise App Items JavaScript JavaScript hide show JS Function Layout Lead Generation Learn Left Left Quote Link LinkedIn list import Live Blog localization Log Logic Login login module login skin object Loop Mandeeps Match Message Microsoft Live Writer module configuration Modules Monthly Services Name Netherlands New News Blog NL NOT NULL oAuth2 Odd OnClick Open Web Studio opt in email OWS Part 1 Part 2 Passed payment gateway paypal Phone Number Placement Post Postback Posts Premium Integration Premium Services Premium Support Primary Key Procedure Products profile Quarterly Services Question question fields Question Loop Question Value QuestionOption Quick Quotes Recommend Recommendation Recurring Billing Redirect Referential Integrity registration Rendered Replace replace html text report views reports Resolution Resource resource files resx Retrieve Retrieving Right Right Quote Rows Ryan Bakerink Sales Force SalesForce Script Scripting Scripts Sequential Access server side validation Silent Post Single Single Quotes Single Sign On skin object Snowcovered Solution sp Springs SQL sql 2005 pivot sql default value SQL Example sql import SQL Injection sql query sql replace statement sql reports SQL Server sql server 2005 SSL SSO stored stored procedure String style sheet stylesheet Submit Submit Button Submit Image Submit Link success story Suggest Suggestion Support Syntax Table technical techwise research Temp test credit card numbers testimonial Text/HTML thumbnail image Time Timer Tip Token Topic Transaction Trial Trigger TSQL T-SQL Tutorial Twitter Types of Constraints Unique Update Highrise user user directory user profile image users online Variable View Web Based Work Around writer writing xls xlsx XML

In the Flow

rss

Data Springs, Inc. - An online diary and web log from staff and customers for premium DotNetNuke resources, Data Springs Modules, and Data Springs Services.


Formatting Phone Number w/ T-SQL for DotNetNuke and Dynamic User Directory User Data

We receive requests from time to time for how you can properly format a phone number (after the fact) when a user has registered within DotNetNuke or using Dynamic Registration but the masked editor or formatting regular expression was never implemented at that time.  I wanted to post a query we have used from time to time that can properly format the phone number data.

Just a quick disclaimer that I have used this query for a long time but I did not originally come up with it (or know who to give credit to for it). If you ever find the original author I would be happy to post their info…

 

Step 1: Create the SQL Server Function:

You can create this stored procedure under Host/SQL

Create FUNCTION [dbo].[func_DataSprings_FormatUSPhoneNumber]
(
         @phonenumber VARCHAR(20)
)
RETURNS VARCHAR(20)
AS
BEGIN

         /** Remove White Space and non-Integer(s) values **/
         WHILE PATINDEX('%[^0-9]%', LTRIM(RTRIM(@phonenumber))) > 0
                BEGIN
                        SET @phonenumber = REPLACE(@phonenumber, SUBSTRING(@phonenumber, PATINDEX('%[^0-9]%', @phonenumber),1), '')
                END

         SET @phonenumber = LTRIM(RTRIM(@phonenumber))


         /** Get the number of Characters **/
        DECLARE @NumChars INT
        SET @NumChars = LEN(@phonenumber)

         /** Check to see if this phone number starts with a '1' **/
        IF @NumChars = 11 AND LEFT(@phonenumber,1) = '1'
                BEGIN
                       SET @phonenumber = RIGHT(@phonenumber,10)
                       SET @NumChars = LEN(@phonenumber)
               END
               
         /** If valid number of digits proceed with formatting **/
        IF @NumChars = 7 OR @NumChars = 10
    
             BEGIN
                        SET @phonenumber = REVERSE(@phonenumber)
     
                       /** Format Phone Number **/
                       SET @phonenumber =
                                REVERSE(LEFT(@phonenumber,4)
                                + '-'
                                + SUBSTRING(@phonenumber,5,3)
                                + COALESCE(' )'
                                + NULLIF(SUBSTRING(@phonenumber,8,3),'') + '(', ''))
                END

         ELSE
                SET @phonenumber = NULL    

RETURN @phonenumber
END
 
Step 2: Determine what the profile field ID is for the Telephone field you want to modify. A great way to find this out is just to go to Host/SQL and execute something like this:

select PropertyDefinitionID, PropertyName from ProfilePropertyDefinition
Where PortalID = 0
Order By PropertyName

This is assuming you are using this on PortalID 0. You will see the PRopertyDefinitionID within the query… I believe the property definition for DotNetNuke is 33 for Telephone initially… and 34 for Cell initially.

Step 3: Make a backup of your database Smile 

Step 4: Run a query to utilize the formatting function and properly format the telephone number for all existing records. It would be executed under Host/SQL and you will want to check the box that says run as script (although it shouldn’t be necessary it will provide you with any error messages if there are any returned). The query would look like this:

Update UserProfile

SEt PropertyValue = dbo.func_DataSprings_FormatUSPhoneNumber(PropertyValue) from UserProfile

Where PropertyDefinitionID = 33

And PropertyValue <> ''

 

Step 5: I believe this data is heavily  cached so you can clear cache by going to Host / Host Settings and clicking Clear Cache / Restart Application. If you are using Dynamic User Directory you will also want to kick off the Dynamic User Directory User Data Feed Scheduled Task/Process before that data will be displayed properly.

 

That is all!

 

Thanks,

 

Chad




Comments are closed.

Recent Comments

 
 

Join our mailing list...

Get current news and events the easy way
 
 
   
Subscribe Me

Recent Blogs...

 
Copyright 2005 - 2011 by Data Springs, Inc.
 
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi