Question:
When I print Delivery Order from Invoice, the document number is still using Invoice document number, I-000013. Is there any way to use report design to change the document number from “I-000013” to “DO-000013”?
Answer:
Yes, you may use the substring function which can retrieves a substring from String. The substring starts at StartPosition.
Substring(String, StartPosition)
1. Click on Design Report.
2. Click on Design on Delivery Order report name.
3. Click on the [DocNo] field, and click on f .
4. Define your Invoice document format and replace it with the new Expression.
a. The format is based on existing document number.
For this case, the format is I-000013
b. Key in the below expression:
'DO'+Substring([DocNo],1)
DO = Format you want, example: DO, D/O
Substring(String, StartPosition)
String = the field name of document number, DocNo
Start Position = input the start position for the substring.
Document number is I-000013. The first character position is 0.
Substring([DocNo],1) result will be -000013
The expression ‘DO’+, mean will add DO in front of it.
Result will be DO-000013
If the document number is SI-000013
The expression will be
'DO'+Substring([DocNo],2)
5. Click on Menu on top left, and click on Save As… and save as a new report name.
6. Preview the report and now the document number will be DO-000013.
By: Aimi 230216, Lay Swan 230221, P230222