I’m trying to export some old Sales Orders from our E10.0 database and the orders have comments with returns that mess up my Excel form I’m using to create a import DMT.
Any hints on how to do this? BAQ Export ? etc.
I’m trying to export some old Sales Orders from our E10.0 database and the orders have comments with returns that mess up my Excel form I’m using to create a import DMT.
Any hints on how to do this? BAQ Export ? etc.
I have used a <LF>
character when building my Excel files for import. This worked for us in 9.05 but I’m not sure that I’ve tried this in 10.1 yet. Excel and DMT seem to handle it OK. As always, please try it in a Test system first.
In my case, I was adding standardized job operation comments and used SQL similar to the following to generate an import file:
select
po.CommentText,
case
when (po.CommentText > '') then (rtrim(ltrim('<AddlCommentText>')) + char(10) + char(10) + rtrim(ltrim(po.CommentText))) -- prepend new comment
-- when (po.CommentText > '') then (rtrim(ltrim(po.CommentText)) + char(10) + char(10) + rtrim(ltrim('<AddlCommentText>'))) -- append new comment
else rtrim(ltrim('<AddlCommentText>'))
end as NewCommentText
from Erp.PartOpr po
where (po.Company = '<MyCompany>')
Just going to hijack this thread.
It may have been covered somewhere else, but I needed to count the number of lines in a comment on an invoice to allow me to export to a limited number of built lines in a text file.
I came across this thread on Stack overflow c# - How to count lines in a string? - Stack Overflow. It gave me the idea. using a \r instead of a \n gave me the count I needed.
I am testing this in Linqpad so as yet not sure if it will work in custom code on a BPM.
/// <summary>
/// Extension class for strings.
/// </summary>
public static class StringExtensions
{
/// <summary>
/// Get the nummer of lines in the string.
/// </summary>
/// <returns>Nummer of lines</returns>
public static int LineCount(this string str)
{
return str.Split('\r').Length;
}
}
example of execution :
//UD03_Row.ShortChar03 represents a string related to the column name of a field in the InvcHead. In this instance the InvoiceComment field.
int NumLines = InvHead[UD03_Row.ShortChar03].ToString().LineCount();
or if you don’t want to add the class/function
int NumLines = .Split(‘\r’).Length;
I hope this helps someone.Preformatted text
That’s a awesome idea Simon. Let me know how it works out.