You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How can I extract a portion of a string using the SLICE function?

Accepted answer


I want to print only the first 7 characters but using the examples of the slicing funciont I wasn´t been able to do it.

for example in this case: Walmart Veracruz

I only want to print: Walmart

I have tested whit these expression but it did not work

"\~order_header.shipto_name"[slice([:7],len( "\~order_header.shipto_name "))]

"\~order_header.shipto_name"[slice((:7)),len( "\~order_header.shipto_name "))]

"\~order_header.shipto_name"[slice((0:-9)),len( "\~order_header.shipto_name "))]

functions={"slice": slice,("\~order_header.shipto_name"[:7])
{"slice": slice,("\~order_header.shipto_name"[:7])
{"slice": slice,("\~order_header.shipto_name"[:7])}

Content (required):

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!