473,394 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Problem with left(text,#) function!

I keep seeing that if the "text" part of
Expand|Select|Wrap|Line Numbers
  1.  left(text, #) 
is "" or zero, that it will return "text", which is what it is doing in my situation.

These are phone numbers that I'm trying to pull the area codes from.

It's actually starting to return the first 3 characters on the left, until it see's a "0" and then it returns the entire number ("text").

It works fine as long as the area code does not contain a "0".

I have this field set as a text field but apparently that isn't good enough.

Does anyone know how to code it so that it will see a "0" as it would any letter, or other number?

Thanks!
Apr 7 '10 #1

✓ answered by missinglinq

To be honest, I'm totally confused as to what you're trying to do with

format([Phone Number],.

and your problem was not with

left(text, #)

as you said, but rather with

Format(Text,Left(Text,3))

At any rate, this works regardless of whether or not the Area Code has a zero in it

AreaCode: Left([Phone Number],3)

Linq ;0)>

4 1652
TheSmileyCoder
2,322 Expert Mod 2GB
Are you using this from within code, or directly in a query?
Apr 7 '10 #2
Directly in a query:

Expand|Select|Wrap|Line Numbers
  1. AreaCode: format([Phone Number], left([Phone Number], 3))
Where "Phone Number" is a phone number. The field is a text field and I have an input mask to force the number n the following format:

1234567890

The problem is that if the first three (area code) contain a "0", it will pull the numbers up to the "0" then copy the entire number after that.

Here's an example:

The number 9896664454 returns 989

The number 9906665445 returns 999906665445 (gets up to the 0, then gets the entire number).

Thanks
Apr 7 '10 #3
missinglinq
3,532 Expert 2GB
To be honest, I'm totally confused as to what you're trying to do with

format([Phone Number],.

and your problem was not with

left(text, #)

as you said, but rather with

Format(Text,Left(Text,3))

At any rate, this works regardless of whether or not the Area Code has a zero in it

AreaCode: Left([Phone Number],3)

Linq ;0)>
Apr 7 '10 #4
Wow, do I feel like a HUGE idiot! I guess I was over doing it, as usual! I had picked up one too many things at once and was trying them together!

Thanks Missinglinq! I appreciate the help very much!
Apr 8 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: TheOne | last post by:
I have two classes: class OntologyParser { ... protected: virtual void startElement(void *userData, const char *name, const char **atts); virtual void endElement(void *userData, const char...
2
by: enio | last post by:
Hi, I intend to get some answer from postgres concerning if an update command has altered some records in the database. To do this I coded this function: create or replace function...
0
by: Crystal | last post by:
I have created a small program that prints out an organization chart in PHP using the GD lib's imagecreate, imageline and imagestring functions. Basically, a user selects an employee from a...
4
by: B. Williams | last post by:
I have written this program for an assignment that requires a static member function to set a static data member, but I can't figure out how to get it to change the value once set. Would someone...
6
by: mforema | last post by:
Hi Everybody, I have a function that worked perfectly when it was used in a query. I received help in creating this function from this discussion: Help with Query and Subform - post #18 ...
8
by: cpptutor2000 | last post by:
Could some C guru please help me? I have a function that takes as an argument a pointer to an array of unsigned chars (basically a hex representation of a dotted decimal IP address). When I print...
4
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
I imagine this is a n00b mistake, but the problem I am having is that the first function(stratQual) is evaluating to "No" despite the argument being passed to it being greater than 80.00. The second...
3
by: viki1967 | last post by:
Hi there. I have a problem with function updateSum(id). The code is this: <script language="javascript" type="text/javascript"> <!--
4
by: StephQ | last post by:
I need to know if it is possible to solve the following problem (I am really stuck at it). Consider the CRTP pattern: struct Derived { ....// May contain void operate( double x ) , may not....
2
by: presencia | last post by:
Hi everyone, I have written a small program running fine until a Segmentation fault. Using a debugger I have localized the function the fault happens in. The Signal appears during a call to delete...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.