Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Remove Hyphen from the database

Hello Everyone,

I have the data where it mention as,  i want to prepare a pivot table where dimension will be my design no with out Hyphen.

  

DESIGN_NOSALES QTY
1425895-EE1
14532861-FD2
58462879999-FF5
1425895-EF4
1425895-EG8
1425895-DD9
14532861-FF10
58462879999-FA1

How to get the data without hyphen,

After Removing of Hyphen,  

Row LabelsSum of SALES QTY
142589522
1453286112
584628799996
Grand Total40
11 Replies
Anil_Babu_Samineni

May be this?

SubField(DESIGN_NO, '-', 1) as DESIGN_NO

And now use dimension as DESIGN_NO

Expression Sum(Sales QTY)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Hi Anil,

Thanks for the reply.

Do i need to write this under Load editor script?

SubField(DESIGN_NO, '-', 1) as DESIGN_NO

And now use dimension as DESIGN_NO

Expression Sum(Sales QTY)

divya_shinde
Partner - Contributor II
Partner - Contributor II

Hii,

you can use

Purgechar(DESIGN_NO,'-') as DESIGN_NO

if you want to remove only - from the DESIGN_NO

rohitraut
Creator
Creator

hello Vivek,

try this ,

KeepChar(DESIGN_NO,' 0123456789') as DESIGN_NO

Bala_s
Contributor III
Contributor III

Hi Vivek,

Use below code in script:


SubField(DESIGN_NO, '-', 1) as DESIGN_NO, after use DESIGN_NO as Dimension, you will get the result.

avinashelite

Use

subfield(s, 'delimiter' [ , index ] )

In its three-parameter version, this script function returns a given substring from a larger string s with delimiter 'delimiter'. index is an optional integer denoting which of the substrings should be returned. If index is omitted when subfield is used in a field expression in a load statement, the subfield function will cause the load statement to automatically generate one full record of input data for each substring that can be found in s.

In its two-parameter version, the subfield function generates one record for each substring that can be taken from a larger string s with the delimiter 'delimiter'. If several subfield functions are used in the same load statement, the Cartesian product of all combinations will be generated.

Examples:

(For three parameters)

subfield(S, ';' ,2) returns 'cde' if S is 'abc;cde;efg'

subfield(S, ';' ,1) returns NULL if S is an empty string

subfield(S, ';' ,1) returns an empty string if S is ';'

Not applicable
Author

Try this

Purgechar(UPPER(DESIGN_NO),'ABCDEFGHIJKLMNOPQRSTUVWXYZ-')

hope this helps

Anil_Babu_Samineni

I don't recommend to use purgechar over here because we don't know real data. So then, what if they have special characters in the first field..

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi Vivek,

Please find below:

Data:

LOAD * Inline [ 

DESIGN_NO,SALESQTY

1425895-EE ,1

14532861-FD,2

58462879999-FF,5

1425895-EF,4

1425895-EG,8

1425895-DD, 9

14532861-FF ,10

58462879999-FA,1

];

NoConcatenate

Fi:

LOAD KeepChar(DESIGN_NO,'1234567890') as [DESIGN NO],

SALESQTY as [SALES QTY]

Resident Data;

Drop Table Data;

Thanks,

Arvind Patil