Focal Point
(CLOSED) Concatenation

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4047022886

November 03, 2017, 11:06 AM
SMW
(CLOSED) Concatenation
Does anyone know if I can concatenate sales order number and sales order line number with "/" as separator, in "Detail Defined" window as shown below?

This message has been edited. Last edited by: SMW,


Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 11:10 AM
RyanIPG13
As I understand it, if they both aren't strings (Alpha) data types you need to do a conversion and use the converted field in place.

Can't concatenate a number with a text value from my experience.


Production: WebFOCUS 8.202M
QA: WebFOCUS 8.206.01
Windows/SQL
November 03, 2017, 11:18 AM
SMW
Hi Ryan,
they both are text fields in file.


Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 11:23 AM
RyanIPG13
Ah in that case yeah should be simple:


FIELD1 | '/' | FIELD2

If you are using spaces in the '/' then i think you need a || double pipe.


Production: WebFOCUS 8.202M
QA: WebFOCUS 8.206.01
Windows/SQL
November 03, 2017, 11:24 AM
eric.woerle
your concatenation characters in WF are | and ||

here is what the help says:

quote:
Concatenating Character Strings
You can write an expression to concatenate several alphanumeric and/or text values into a single character string. The concatenation operator takes one of two forms, as shown in the following table:


| Weak concatenation.
Preserves trailing spaces.

|| Strong concatenation.
Suppresses trailing spaces.




Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
November 03, 2017, 11:39 AM
SMW
I followed both your advices, got below error message. I think Ryan is correct that one of the fields is numeric.
Now I have to figure out how to convert the numeric to text field Frowner



Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 11:45 AM
Tony A
Use something like this -
COMPUTE yourfield/Ann = LJUST([length],FPRINT([numerical field],[usage format],[output format]),[output format]) || '/' || [your alpha field];

e.g.

COMPUTE mystring/A35 = LJUST(9,FPRINT(value,'I9','A9'),'A9') || '/' || textfield;


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 03, 2017, 12:07 PM
SMW
Hi Tony,
I assume that I can't implement your suggestion in the "Detail Define" window? It needs to be done in coding?


Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 12:20 PM
MartinY
quote:
I assume that I can't implement your suggestion in the "Detail Define" window? It needs to be done in coding?

In the "Define Detail" Window you can type in what you want. It is not mandatory to click and choose.
you even have a Function tab (or button) from where to choose IB functions


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 03, 2017, 01:04 PM
Tony A
quote:
It needs to be done in coding?

Not really. You can click the various components if you wish to, but nested functions can sometimes be a little "trying", so it is mostly easier to type the code in as Martin suggests.

Of course, typing in the code does require knowledge of what you are typing so it may be easier for you to create a define (or compute) for the inner nested function (the FPRINT) using the GUI "clicks" and then utilise that define (or compute) within another define (or compute) as one of the arguments for the outer function (the LJUST).

Of course, old hacks like me baulk at that because we know that we can type in the nested functions easier than spending some time clicking around the GUI, but then that probably covers a rather large number of contributors here! Wink

Good luck

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
November 03, 2017, 01:30 PM
SMW
I did see the Function tab, Martin. Thank you. Just need to learn to use it.

Thank you both Tony and Martin!

What is GUI? I see this terminology being used a lot.


Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 02:06 PM
Prarie
Stands for "Graphical User Interface" and is pronounced "gooey."
November 03, 2017, 02:40 PM
SMW
Thank you, Prarie!

Everyone has given me a lot of hints to help solve my problem. I tried to read through the Help session as well as previous discussions, still can't solve the numeric to text conversion issue.

What I need is direct conversion, no leading zero, nor decimals involved.

for example, sales order line item could be 10 or 660.

Is it possible that one of your experts show me exactly how to do it in "Detail Define" window?

Many thanks Smiler


Production WF 8.1, Test WF 8.2
Windows
HTML 5
November 03, 2017, 04:02 PM
MartinY
It is not easy into a forum to show you how to use a GUI.
But all the following can be performed with the GUI.

For the purpose of the sample I have converted the SALES field into one that have thousand separator and decimal for then remove them.
It may not be the only way. In WF you usually have multiple way to do the same thing.
And some times you need to perform "stupid" action to get to desired result (such as field DSALES to "remove" the decimal but keep its value).
But in your case it is possible that you don't have any decimal to keep

DEFINE FILE CAR
NSALES /D10.2C = SALES / 30;
DSALES /D10c   = NSALES * 100;
TXT1   /A30V   = FPRINT(DSALES, 'D10c', 'A12') || '-' || CAR;
TXT2   /A30V   = TRIM('L', EDIT(DSALES), 10, '0', 1, 'A10') || '-' || CAR;
END
TABLE FILE CAR
PRINT NSALES
      DSALES
      TXT1
      TXT2
BY COUNTRY
END


Sometime you need to use your imagination and be creative :-)


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
November 03, 2017, 04:12 PM
SMW
Hi Martin,
You have gone above and beyond to help me with this issue, can't say enough appreciation!

I will follow your example, and play around it.

Thanks again!!


Production WF 8.1, Test WF 8.2
Windows
HTML 5