Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
a) I have a style field in database. I need to place - after 1st five digits or characters.
Actual Style | Expected Style |
1EA45EMN5 | 1EA45-EMN5 |
2BA45MNP6 | 2BA45-MNP6 |
8cde1HJK2C | 8cde1-HJK2C |
In case you have more digits in the field:
Value:
load Actual,index(Actual,5)as Index,left(Actual,5)&'-'&right(Actual,len(Actual)-5) as Expected inline [
Actual
1EA45EMN5
2BA45MNP6
8cde1HJK2C
aaaaaaaaaaa
];
Try this:
Value:
load Actual,left(Actual,5)&'-'&right(Actual,5) as Expected inline [
Actual
1EA45EMN5
2BA45MNP6
8cde1HJK2C
];
In case you have more digits in the field:
Value:
load Actual,index(Actual,5)as Index,left(Actual,5)&'-'&right(Actual,len(Actual)-5) as Expected inline [
Actual
1EA45EMN5
2BA45MNP6
8cde1HJK2C
aaaaaaaaaaa
];
or maybe just
mid(Actual, 6) for the right-hand side.
-Rob
Thanks for the reply. But, In the style field We are getting 12 characters some times in style field and 8 characters . In that case some characters are truncating if you hard code. I just need '- 'after 5 characters from left.
I have used below expr in chart
=left(STYLE,4)&'-'& right(STYLE,5)
STYLE | ||
P3SoQt4368 | P3so-t4368 | Q is truncating |
BETR5678 | BETR-5678 | correct |
=left(STYLE,4)&'-'& mid(STYLE,5)
-Rob