How does your AOI work if I want to build an AOI that will concatenate 2 strings with custom string length?
Say STR1_50 (.Len=50) concat w STR2_100 (LEN=100) output to STR3_462(len=462)
and the next case:
STR4_60 (.Len=60) concat w STR5_110 (LEN=110) output to STR6_462(len=462)
This is more of a technique than an AOI. Basically, JeremyM has shown that it is possible to read and write to Strings (and technically, other objects like UDTs or arrays) without needing to make an InOut tag.
If your STR1_50 was needed by PLC code outside of the AOI (an HMI can access that string directly as a local parameter, provided its properties are set to Read/Write, which is not the default, IIRC), then you would create an output tag in your AOI that is aliased to the STR1_50.LEN tag that is a local tag in the AOI (STR1_LEN"), as well as another input tag aliased to STR1.DATA[0] ("STR1_DATA_Start").
In your AOI, you would also have a rung with a SIZE(STR1.DATA) instruction whose output is another output parameter to the AOI ("STR1_DATA_LEN").
Then, get the data from, say, a controller scoped string ("FirstPrefix") in the PLC into your AOI ("Concat_AOI"), you'd have an instruction COP(FirstPrefix, Concat_AOI.STR1_DATA_Start, Concat_AOI.STR1_DATA_LEN ). This would copy, byte by byte, the characters stored in FirstPrefix and put them in your AOI's STR1.
So that you don't have junk data $00/$00 in your string, you would also MOV the string length from the source to the destination:
MOV (FirstPrefix.LEN, Concat_AOI.STR_LEN ).
You'd do the same for any other tags that you want to move into the AOI's local tags.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the results of your concatenation out of your AOI without using an In/Out parameter, all you need is a tag in your AOI that is aliased to the desired output tags length (Tag: STR3_LEN, aliased to STR3.LEN, where STR3 is a STR3_110 data type that is a local scoped, not In/Out, in the AOI.
The instruction COP(Concat_AOI.STR3_LEN, CombinedString, 1) will start copying the data within your AOI, starting from STR3.LEN, putting it into CombinedString.LEN, and keep moving bytes until it has copied all the characters stored in STR3 into CombinedString.
Or, you could just let your strings be In/Out parameters. It can be cleaner and easier to understand. One advantage to JeremyM's method is that the data move can be done conditionally, whereas as an In/Out parameter, the copy happens every time the AOI is scanned.