#132530 - 02/19/06 08:28 PM
Why LEFT, but not SUBSTR in Set Field
|
addict
Registered: 03/11/04
Posts: 407
|
I am using the LEFT() function to make sure a field (being populated by an Active Link set fields command) stays within the limits for field length..
I Unsuccessfully tried the SUBSTR command.. any explanation.
Example of the VALUE which fails.. SUBSTR($Project$, 1, 30)
Example of the VALUE which works.. LEFT($Project$, 30)
Any explanation why SUBSTR doesn't work?
Oh.. as I modify the set fields AL, the value goes to SUBSTR($Project$, "1", "30")
WEIRD...........
Phil
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
|
|
Top
|
|
|
|
|
#132531 - 03/07/06 03:23 AM
Re: Why LEFT, but not SUBSTR in Set Field
[Re: abdul_cybermak]
|
newbie
Registered: 07/21/05
Posts: 14
|
Maybe your locale uses commas as the decimal separator?
Aaron Keller ARSystem Applications Developer SunCom W I R E L E S S
* Phone: (610) 722-4486 * Fax: (610) 993-2689 * Email: akeller@suncom.com
-----Original Message----- From: Action Request System discussion list(ARSList) [mailto:arslist@ARSLIST.ORG] On Behalf Of Phil Mougis Sent: Monday, February 20, 2006 3:29 PM To: arslist@ARSLIST.ORG Subject: Why LEFT, but not SUBSTR in Set Field
I am using the LEFT() function to make sure a field (being populated by an Active Link set fields command) stays within the limits for field length..
I Unsuccessfully tried the SUBSTR command.. any explanation.
Example of the VALUE which fails.. SUBSTR($Project$, 1, 30)
Example of the VALUE which works.. LEFT($Project$, 30)
Any explanation why SUBSTR doesn't work?
Oh.. as I modify the set fields AL, the value goes to SUBSTR($Project$, "1", "30")
WEIRD...........
Phil
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
|
|
Top
|
|
|
|
|
#132532 - 03/06/06 10:53 PM
Re: Why LEFT, but not SUBSTR in Set Field
[Re: abdul_cybermak]
|
old hand
Registered: 06/12/01
Posts: 769
|
SUBSTR is 0-based. First position is 0, last position is length - 1.
Jim O'Hara ISTS Application Services (IAS) Shared Applications - Change Control Tools 245 Market St., room 724A jlo4@PGE.com (415) 973-1401
-----Original Message----- From: Action Request System discussion list(ARSList) [mailto:arslist@ARSLIST.ORG] On Behalf Of Aaron Keller Sent: Tuesday, March 07, 2006 7:23 AM To: arslist@ARSLIST.ORG Subject: Re: Why LEFT, but not SUBSTR in Set Field
Maybe your locale uses commas as the decimal separator?
Aaron Keller ARSystem Applications Developer SunCom W I R E L E S S
* Phone: (610) 722-4486 * Fax: (610) 993-2689 * Email: akeller@suncom.com
-----Original Message----- From: Action Request System discussion list(ARSList) [mailto:arslist@ARSLIST.ORG] On Behalf Of Phil Mougis Sent: Monday, February 20, 2006 3:29 PM To: arslist@ARSLIST.ORG Subject: Why LEFT, but not SUBSTR in Set Field
I am using the LEFT() function to make sure a field (being populated by an Active Link set fields command) stays within the limits for field length..
I Unsuccessfully tried the SUBSTR command.. any explanation.
Example of the VALUE which fails.. SUBSTR($Project$, 1, 30)
Example of the VALUE which works.. LEFT($Project$, 30)
Any explanation why SUBSTR doesn't work?
Oh.. as I modify the set fields AL, the value goes to SUBSTR($Project$, "1", "30")
WEIRD...........
Phil
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
|
|
Top
|
|
|
|
|
#132533 - 03/06/06 11:40 PM
Re: Why LEFT, but not SUBSTR in Set Field
[Re: abdul_cybermak]
|
journeyman
   
Registered: 11/04/05
Posts: 51
|
The bit about zero-counting is right, but as far as determining "last position" I think you're remembering the rule for Perl's substr function. In Remedy, using -1 as the final argument to SUBSTR yields null.
It would be very handy if Remedy's function worked the same way as Perl's, but the usual way to get to the last position of the string (other than counting it explicitly with a STRSTR) is to omit the last argument.
Get me 3 characters in $String$ starting with the 2nd character:
SUBSTR($String$, 1, 3)
Get me all the characters in $String$ following and including the 3rd character:
SUBSTR($String$, 2)
--Tim
--- "O'Hara, Jim" wrote:
> SUBSTR is 0-based. First position is 0, last position is length - 1. > > > Jim O'Hara > ISTS Application Services (IAS) > Shared Applications - Change Control Tools > 245 Market St., room 724A > jlo4@PGE.com > (415) 973-1401 > > > -----Original Message----- > From: Action Request System discussion list(ARSList) > [mailto:arslist@ARSLIST.ORG] On Behalf Of Aaron Keller > Sent: Tuesday, March 07, 2006 7:23 AM > To: arslist@ARSLIST.ORG > Subject: Re: Why LEFT, but not SUBSTR in Set Field > > Maybe your locale uses commas as the decimal separator? > > > > Aaron Keller > ARSystem Applications Developer > SunCom > W I R E L E S S > > * Phone: (610) 722-4486 > * Fax: (610) 993-2689 > * Email: akeller@suncom.com > > > > -----Original Message----- > From: Action Request System discussion list(ARSList) > [mailto:arslist@ARSLIST.ORG] On Behalf Of Phil Mougis > Sent: Monday, February 20, 2006 3:29 PM > To: arslist@ARSLIST.ORG > Subject: Why LEFT, but not SUBSTR in Set Field > > I am using the LEFT() function to make sure a field (being populated by > an Active Link set fields command) stays within the limits for field > length.. > > I Unsuccessfully tried the SUBSTR command.. any explanation. > > Example of the VALUE which fails.. > SUBSTR($Project$, 1, 30) > > Example of the VALUE which works.. > LEFT($Project$, 30) > > Any explanation why SUBSTR doesn't work? > > Oh.. as I modify the set fields AL, the value goes to > SUBSTR($Project$, "1", "30") > > WEIRD........... > > Phil > > > > UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > > > > UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > >
> UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > >
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
|
|
Top
|
|
|
|
|
#132534 - 03/09/06 09:12 PM
Re: Why LEFT, but not SUBSTR in Set Field
[Re: abdul_cybermak]
|
old hand
Registered: 06/12/01
Posts: 769
|
Sorry, I meant (length - 1)
Jim O'Hara
-----Original Message----- From: Action Request System discussion list(ARSList) [mailto:arslist@ARSLIST.ORG] On Behalf Of Tim Widowfield Sent: Tuesday, March 07, 2006 3:41 PM To: arslist@ARSLIST.ORG Subject: Re: Why LEFT, but not SUBSTR in Set Field
The bit about zero-counting is right, but as far as determining "last position" I think you're remembering the rule for Perl's substr function. In Remedy, using -1 as the final argument to SUBSTR yields null.
It would be very handy if Remedy's function worked the same way as Perl's, but the usual way to get to the last position of the string (other than counting it explicitly with a STRSTR) is to omit the last argument.
Get me 3 characters in $String$ starting with the 2nd character:
SUBSTR($String$, 1, 3)
Get me all the characters in $String$ following and including the 3rd character:
SUBSTR($String$, 2)
--Tim
--- "O'Hara, Jim" wrote:
> SUBSTR is 0-based. First position is 0, last position is length - 1. > > > Jim O'Hara > ISTS Application Services (IAS) > Shared Applications - Change Control Tools > 245 Market St., room 724A > jlo4@PGE.com > (415) 973-1401 > > > -----Original Message----- > From: Action Request System discussion list(ARSList) > [mailto:arslist@ARSLIST.ORG] On Behalf Of Aaron Keller > Sent: Tuesday, March 07, 2006 7:23 AM > To: arslist@ARSLIST.ORG > Subject: Re: Why LEFT, but not SUBSTR in Set Field > > Maybe your locale uses commas as the decimal separator? > > > > Aaron Keller > ARSystem Applications Developer > SunCom > W I R E L E S S > > * Phone: (610) 722-4486 > * Fax: (610) 993-2689 > * Email: akeller@suncom.com > > > > -----Original Message----- > From: Action Request System discussion list(ARSList) > [mailto:arslist@ARSLIST.ORG] On Behalf Of Phil Mougis > Sent: Monday, February 20, 2006 3:29 PM > To: arslist@ARSLIST.ORG > Subject: Why LEFT, but not SUBSTR in Set Field > > I am using the LEFT() function to make sure a field (being populated > by an Active Link set fields command) stays within the limits for > field length.. > > I Unsuccessfully tried the SUBSTR command.. any explanation. > > Example of the VALUE which fails.. > SUBSTR($Project$, 1, 30) > > Example of the VALUE which works.. > LEFT($Project$, 30) > > Any explanation why SUBSTR doesn't work? > > Oh.. as I modify the set fields AL, the value goes to > SUBSTR($Project$, "1", "30") > > WEIRD........... > > Phil > > > > > UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > > > > > UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > >
> UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org > >
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
UNSUBSCRIBE or access ARSlist Archives at http://www.ARSLIST.org
|
|
Top
|
|
|
|
|
|
|