cancel
Showing results for 
Search instead for 
Did you mean: 
bhashwar_bhatta
Nintex Newbie

How to Get First 15 letters from a sentence

Jump to solution

For example if i have a company name: Aeronautical Machine Transportation and Repair Company PVT. LTD.

From above example i would like to get only first 15 letters in all capital letters including space "AERONAUTICAL MACH" or i am not sure if space is also counted as a letter?

Labels: (1)
Reply
10 Replies
TomaszPoszytek
Automation Master
Automation Master

Re: How to Get First 15 letters from a sentence

Jump to solution

Hi!

Are you using Nintex Forms in your solution? Is the company name being there provided by a user, using a form? If so, you could use inline functions in Nintex Form, to dynamically calculate the information you need, using the PadLeft and ToUpper functions: http://help.nintex.com/en-US/o365/#o365/O365Forms/ReferenceOther/Inlinefunctionsprovided.htm then to save the outcome in another field of your choice.

On the other hand, if you don't use Forms, Nintex Workflow for O365 doesn't have inline functions yet To get the first 15 characters out of your string you should then create an integer variable having its default value = 0, a loop with a condition to run until the variable is equal or greater 15, then in each run get the substring from a string starting on position indicated by the variable and having length = 1. The append such extracted character to a string variable of your choice. This approach will let you to get first 15 characters, however won't capitalize them. I have no better idea for capitalization better than having a replace action replacing each lowercase letter with its uppercase counterpart.

Regards,

Tomasz

Reply
paul_crawford
Nintex Newbie

Re: How to Get First 15 letters from a sentence

Jump to solution

Hi Bhashwar Bhattarai

My approach would be to use the inline function substring:

fn-ToUpper(fn-Substring(Your String,Index to start,number of characters))

fn-ToUpper(fn-Substring(Aeronautical Machine Transportation and Repair Company PVT. LTD,0,15))

which would give you

AERONAUTICAL MA

You would just need to change the number of characters to return to get your desired result

Hope this helps

View solution in original post

Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to Get First 15 letters from a sentence

Jump to solution

‌ you are correct but only when talking about the on premise Nintex. As I wrote above - inline functions are not available for Nintex Workflow in Office 365, so that will not work. However, such construction can be used in Nintex Forms even in Office 365, as mentioned above again

Regards,

Tomasz

Reply
paul_crawford
Nintex Newbie

Re: How to Get First 15 letters from a sentence

Jump to solution

Hi

Don't disagree with anything you wrote, I just couldn't get PadLeft to work for a number of characters, I have used that to add spaces or leading zeros. Substring is how I would approach it. Hope I didn't offend

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to Get First 15 letters from a sentence

Jump to solution

What I meant in general is that your approach is not possible in Nintex Workflow for Office 365 because there are no inline functions So your solution is perfect, but not for the Office 365

0 Kudos
Reply
paul_crawford
Nintex Newbie

Re: How to Get First 15 letters from a sentence

Jump to solution

Tomasz Poszytek

Still fully on prem sorry!!! does regex work??

^.{0,15}

would do the same

Reply
TomaszPoszytek
Automation Master
Automation Master

Re: How to Get First 15 letters from a sentence

Jump to solution

No problem

The regex! Very smart approach. I like it. Simple and fast.

The last thing to solve then is how to uppercase the string

0 Kudos
Reply
bhashwar_bhatta
Nintex Newbie

Re: How to Get First 15 letters from a sentence

Jump to solution

Thank you Tomasz for your reply,

While creating a question i did not see an option to categorize this question as a SharePoint on prem, and we do have an on prem environment.

The solution provided by Paul worked perfectly, and i am pretty sure we could use various methods and the method provided by you will work as well.

0 Kudos
Reply
bhashwar_bhatta
Nintex Newbie

Re: How to Get First 15 letters from a sentence

Jump to solution

Thank you Paul,

Your solution hit the nail in the head. I was trying to do a SQL insert and the column (sort name) that came from name has max 15 varchar length.

Reply