Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]removing leading character from all the values of car field in car file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]removing leading character from all the values of car field in car file
 Login/Join
 
Member
posted
I want to remove leading character from all values of the field car in car file,using TRIMV I was able to remove only from one value,is it possible to remove from all the values.
example: BMW as MW,AUDI as UDI.

This message has been edited. Last edited by: Darshan Patil,
 
Posts: 10 | Location: Bangalore | Registered: July 31, 2018Report This Post
Virtuoso
posted Hide Post
Darshan,

It's not clear for me, what do you want exactly ?
You want to remove the first character of a field no matter what ?

TRIMV will only remove the specified characters string. Normally used to remove leading or trailing spaces or a string pattern that exist almost everywhere

To remove the first character no matter which character is, you can use
EDIT(my_field, '$999999');

Where you put as many 9 as the number of character that you want to keep and the as many $ than character that you want to remove.
You can combine as you whish and can even replace character by other.
EDIT(my_field, '99$-9$/9999$9');

Sample
TABLE FILE CAR
PRINT COMPUTE NCAR1/A24 = EDIT(MODEL, '$99999999999999999999999');
      COMPUTE NCAR2/A24 = EDIT(MODEL, '99$-9$/9999$ 99999999999');
BY COUNTRY
BY CAR
END

EDIT function may be one of the options


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
Thanks Martin
That is what I was looking for,it works.
 
Posts: 10 | Location: Bangalore | Registered: July 31, 2018Report This Post
Expert
posted Hide Post
Ensure that the number of 9's that you use in the EDIT command covers the length of field being edited, otherwise you'll miss some of the trailing data.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
My pleasure.

Please update your first post then in the subject at the beginning add [SOLVED].


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
This also works fine

DEFINE FILE CAR
LENGTH/I2=ARGLEN(16,CAR,'I2');
LEAD_CHAR/A16=SUBSTV(LENGTH,CAR,2,LENGTH,LEAD_CHAR);
BY CAR
END
TABLE FILE CAR
PRINT LEAD_CHAR
BY CAR
END

Or we can use EDIT as Martin said.

DEFINE FILE CAR
LEAD_CHAR/A20=EDIT(CAR,'$999999999')
END
TABLE FILE CAR
PRINT LEAD_CHAR
BY CAR
END
 
Posts: 10 | Location: Bangalore | Registered: July 31, 2018Report This Post
Virtuoso
posted Hide Post
In my experience, it's often better to use the new "Simplified * functions".

One reason being that they're agnostic to the lengths of the values they operate on, the other is that the non-simplified functions frequently cannot be translated to SQL.

That can cause performance issues when WF chooses to perform the function on the result-set it retrieves from the RDBMS instead of performing it there, especially when that resultset is significantly larger because the function cannot be used to limit the size of the set.

In this case, you're looking for: https://infocenter.information...s/source/topic76.htm

DEFINE FILE CAR
    CAR_TAIL/A16 = SUBSTRING(CAR, 2, 15);
END
TABLE FILE CAR
PRINT CAR_TAIL
BY CAR
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]removing leading character from all the values of car field in car file

Copyright © 1996-2020 Information Builders