Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi i have the following question.
i wish to avoid the following scenario by setting the length of my fields to 6 and 3 accordingly and filling the blank values with 0.
Ordernr | RowNr |
---|---|
W1001 | 20 |
W100 | 120 |
Desired result.
Ordernr (set to 6 character) | RowNr (set to 3 characters) |
---|---|
00W1001 | 020 |
W100 | 120 |
is this possible?
Best
Brad
you say you want length of 6 and 3 but your desired result is diffferent
SCRIPT
Inline:
load OrderNo, text(RowNo) as RowNo;
LOAD * INLINE [
OrderNo, RowNo
W1001, 20
W100, 120
];
Load
repeat('0', 6 - len(OrderNo)) & OrderNo as OrderNo,
repeat('0', 3 - len(RowNo)) & RowNo as RowNo,
autonumber(OrderNo & RowNo) as %Key
Resident Inline;
drop table Inline;
RESULT (lOrderNo ength 6, RowNo length 3)
OrderNo | RowNo |
0W1001 | 020 |
00W100 | 120 |
you say you want length of 6 and 3 but your desired result is diffferent
SCRIPT
Inline:
load OrderNo, text(RowNo) as RowNo;
LOAD * INLINE [
OrderNo, RowNo
W1001, 20
W100, 120
];
Load
repeat('0', 6 - len(OrderNo)) & OrderNo as OrderNo,
repeat('0', 3 - len(RowNo)) & RowNo as RowNo,
autonumber(OrderNo & RowNo) as %Key
Resident Inline;
drop table Inline;
RESULT (lOrderNo ength 6, RowNo length 3)
OrderNo | RowNo |
0W1001 | 020 |
00W100 | 120 |