New line in text constant using STRSUBSTNO

notadev
Member Posts: 5
Hi all,
I'm trying to add aditional information to a sales invoice when using "get shipment lines".
The first line is always the "shipment no" and is found in table 111: SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
I would like to add a second line with the customer reference and external doc no.
Can someone point me in the right direction please?
//Edit: I'm looking for a solution to display in a page, not a report.
I'm trying to add aditional information to a sales invoice when using "get shipment lines".
The first line is always the "shipment no" and is found in table 111: SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
I would like to add a second line with the customer reference and external doc no.
SalesLine.Description := STRSUBSTNO(Text000,"Document No.","Customer Order Reference","External Document No.")I tried all possible solutions to insert a new line, but none seem to work in this case. And almost all hits on google refer to RDLC...
Can someone point me in the right direction please?
//Edit: I'm looking for a solution to display in a page, not a report.
0
Best Answer
-
@notadev , I would suggest instead of
IF SalesLine."Shipment No." <> "Document No." THEN BEGIN
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
END;
use
IF SalesLine."Shipment No." <> "Document No." THEN BEGIN
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text001,"Customer Order Reference");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text002,"External Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
END;
You just need to create 2 new text contants (e.g. Text001 and Text002) as it's made for Text000.Let's go!5
Answers
-
The original Text000 is just "Shipment No. %1"
With "Shipment No. %1 %2 %3" I can get all the data on one line. So data retrieval is no problem.
For the new line I tried with \, \\, \n, LF, CR, CRLF,.... in both the text constant and the code.0 -
@notadev , aah, interesting. And where do you want to see these multiline text - on the page or on the report? If on the page, I'm not sure that it's possible using standard page elements as they do not support multiline. To make thing more clear, you can attach the screenshot to your answers.Let's go!0
-
i believe you need to insert two new sales lines after the "shipment no" line with init-insert statements. also you need two new text global variables. the carriage returns are not what you're looking for.1
-
@latronamarran , totally agree. This is the easiest way to reach desired result as I got it.Let's go!0
-
Thank you both for your answers. Unfortunately I'm totally lost now. I can't figure out how to add the second sales line.
This is the current code:SETRANGE("Document No.","Document No."); Rec.CALCFIELDS("Customer Order Reference"); Rec.CALCFIELDS("External Document No."); TempSalesLine := SalesLine; IF SalesLine.FIND('+') THEN NextLineNo := SalesLine."Line No." + 10000 ELSE NextLineNo := 10000; IF SalesInvHeader."No." <> TempSalesLine."Document No." THEN SalesInvHeader.GET(TempSalesLine."Document Type",TempSalesLine."Document No."); IF SalesLine."Shipment No." <> "Document No." THEN BEGIN SalesLine.INIT; SalesLine."Line No." := NextLineNo; SalesLine."Document Type" := TempSalesLine."Document Type"; SalesLine."Document No." := TempSalesLine."Document No."; LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code"); SalesLine.Description := STRSUBSTNO(Text000,"Document No."); LanguageManagement.RestoreGlobalLanguage; SalesLine.INSERT; NextLineNo := NextLineNo + 10000; END;
0 -
@notadev , I would suggest instead of
IF SalesLine."Shipment No." <> "Document No." THEN BEGIN
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
END;
use
IF SalesLine."Shipment No." <> "Document No." THEN BEGIN
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text000,"Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text001,"Customer Order Reference");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
SalesLine.INIT;
SalesLine."Line No." := NextLineNo;
SalesLine."Document Type" := TempSalesLine."Document Type";
SalesLine."Document No." := TempSalesLine."Document No.";
LanguageManagement.SetGlobalLanguageByCode(SalesInvHeader."Language Code");
SalesLine.Description := STRSUBSTNO(Text002,"External Document No.");
LanguageManagement.RestoreGlobalLanguage;
SalesLine.INSERT;
NextLineNo := NextLineNo + 10000;
END;
You just need to create 2 new text contants (e.g. Text001 and Text002) as it's made for Text000.Let's go!5 -
That is exactly what I needed. Thank you so much!0
-
To get a new line character you must 'build it' manually, one way of making it up is something like this:
NL := ' '; //two spaces here NL[1] := 13; NL[2] := 10
NL is Text[2] variable
Then you can the use it like this:SalesLine.Description := STRSUBSTNO(Text000,"Document No.", NL, "Customer Order Reference","External Document No.")
Text000 would be then "Shipment No. %1%2%3 %4"
You may need to change properties of the field used to display the SalesLine.Description on your RDLC report to enable Multiline on it.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions