Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

Reduce size

hi How to reduce the size of the content

I jave a field by name Description Which has the below conetent

I want to show only one word

How do i write at the script ?

DIPHTHEROIDS-CORYNEBACTERIUM SPECIES

MORGANELLA MORGANII subsp. MORGANII

.

.

.

.and son

1 Solution

Accepted Solutions
avinashelite

can you have some more sample ??

if it always have the - has the separator ...then

subfield(fieldname,'-',1)

OR

left(fieldname,10)

View solution in original post

9 Replies
Digvijay_Singh

May be Purgechar(String,'Characters to be removed should be here') can help

avinashelite

can you have some more sample ??

if it always have the - has the separator ...then

subfield(fieldname,'-',1)

OR

left(fieldname,10)

kkkumar82
Specialist III
Specialist III

May be

Subfield(Fieldname, '-')

Which will remove the text after the first '-'.

In your case it will return

DIPHTHEROIDS


Thanks

Kiran kumar

smilingjohn
Specialist
Specialist
Author

Hi digvijay

Ther are many charecter ,

How can i write all the things ?

I have around 10000 rows

Digvijay_Singh

I think I misunderstood, If you want the first word like DIPHTHEROIDS having '-' always after that then use subfield as others rightly suggested.


Purgechar is used when you want to remove special characters or the characters you know you don't need. For example PurgeChar('ABCD123$#%$','123$#%$') will remove all non alphabetic chars.

smilingjohn
Specialist
Specialist
Author

Hi Kumar

I want to keep only first field and remove everything afte first word

Clever_Anjos
Employee
Employee

Subfield(replace(yourfield,'-',' '),' ',1) would return first word splitted by ' ' or '-'

awhitfield
Partner - Champion
Partner - Champion

Hi John,

something along these lines:

Data:
Load * Inline
[
Description
DIPHTHEROIDS-CORYNEBACTERIUM SPECIES MORGANELLA MORGANII subsp. MORGANII
]
;

Data01:
NoConcatenate
Load SubField(Description, ' ', 1) as Description
Resident Data;

Drop table Data;

HTH

Andy

kkkumar82
Specialist III
Specialist III

Hi,

You can use subfield here and if you still find '-' as part of the string, you can use trim, purgechar or replace to remove that character.

Thanks

Kiran Kumar