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

Number to String

Hi,

I have a field 'COV' which has values like this:  51 , 85 > 2M.

When i apply num#(COV) as COV in script, I got result 51 but not getting 85 > 2M as this is a string.

How can i get both values here?

Thanks

1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

No it is not


LOAD *,ALT(NUM(COV),NUM(LEFT(TEXT(COV),INDEX(COV,' ',1)))) AS COV_RESULTS;
load * inline [
item,COV
a,51
b, 85 > 2M
];

Capture.PNG

Learning never stops.

View solution in original post

11 Replies
pradosh_thakur
Master II
Master II

alt(num#(COV),TEXT(COV)) AS COV

Learning never stops.
Anonymous
Not applicable
Author

By doing this still i m getting only 51 and not 85 > 2M

Anonymous
Not applicable
Author

Is this possible that '> 2M' would get removed from '85 > 2M' and only figure 85 would show from this?

stigchel
Partner - Master
Partner - Master

You can use subfield for that

=Alt(COV,SubField(COV,' ')) as COV

pradosh_thakur
Master II
Master II

Please change your code accordingly something like this ALT(NUM(COV),NUM(LEFT(TEXT(COV),INDEX(COV,' ',1)))) AS COV  below is an example


ABC:

LOAD *INLINE [

AGE

1

400 >2M

];

LOAD ALT(NUM(AGE),TEXT(AGE)) AS AGE1

RESIDENT ABC;    // ONE IN TEXT ONE IN NUM

LOAD ALT(NUM(AGE),NUM(LEFT(TEXT(AGE),INDEX(AGE,' ',1)))) AS AGE2

RESIDENT ABC;  // >2M REMOVED

Learning never stops.
Anil_Babu_Samineni

What are you need as result?

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

This solution is helpful and working but only for three fields.

And i have four fields where i want this result. why it is not working for my fourth field??

Thanks

pradosh_thakur
Master II
Master II

Hi Wajiha

you need to tell what your fields are. unless you tell them we will not be able to provide any solution.

BTW did you try my suggestion?

Learning never stops.
Anonymous
Not applicable
Author

Yes i had tried your solution but that solution is making two different fields from a single field.

What i want is both results in a single field.

for eg:

111.PNG

From above example, if i select item 'A' then it would show me 51 and when i select item 'B' it would show me 85.