Sign in to follow this  
Followers 0
mister x

Alternative to TEXTJOIN for creating code

4 posts in this topic

Well, after 3 hours of screwing around, I'm stopping to ask for directions lol.  I'm looking for a way to create multiple lines of LAD/ST going from a single ControlLogix line, copied into Excel (or better alternative), and then populated x amount of lines and re-read into Logix 5000.  Example:

XIC ? OTE seven_tags.0 (copied from Logix 5000 rung)

....

XIC ? OTE seven_tags.7 

I haven't defined the XICs yet, and want to copy the original line seven more times incrementing to seven_tags.7

There is no JOINTEXT in Excel Professional Plus 2016(argh!), and the online Excel doesn't seem to have a convenient function to break the copied LAD line into columns, like the Text to Columns Wizard in Excel 2016.  Any better ideas than having to use both Excel programs?

 

Share this post


Link to post
Share on other sites

I just used the text to columns in excel 2016, with just a "Space" as delimiter. and excel break is into 4 cells.

Cell A1: XIC

Cell B1: ?

Cell C1: OTE

Cell D1: seven_tags.0

Then dragged the lower right corner of cell D1 down to "seven_tags.7"

 

Then in Cell G1 i entered =A$1&" "&B$1&" "&C$1&" "&D1

and dragged cell G1 down to G8.

This will solve your question about excel, but i dont think you are able to import it into logix again.

2019-03-30_12-13-26.jpg.d164f370d66a1fb9

 

If you want to able to import your changes to logix, firstly try to export your routine with just " XIC ? OTE seven_tags.0" created in it, and open the export file in a text editor.. You will see that logix uses XML, Nice!

This is the part you want to copy and modify:

2019-03-30_12-30-57.thumb.jpg.de038ff7f1

Copy this 7 times and increment the rung number and seven_tags.index.. Save your file and import the routine back into logix.

You can use excel to create the syntaxes for you, in a simelar way as i did in the above explanation.

XML should not care about whitespaces and new lines, so you can create the XML as "<Rung Number="0" Type="N"><Text><![CDATA[XIC(?)OTE(seven_tags.0);]]></Text></Rung>" and still be able to import it.

 

I hope it makes sense, and wish you the best of luck with your auto-generate project :)

 

 

1 person likes this

Share this post


Link to post
Share on other sites

That helps a bit, thanks for the detailed post.:-)

 

Another problem though.  I opened a .CSV tagfile in Notepad++.  I deleted a few tag lines and saved the file again.  Now when I try to import back into Logix, I get an error:

Error: Line 25: Unexpected end of file encountered.

I don't see anything odd at the end of the file, using V28...

V28_RMG_playing_with_arrays.Notepad-Tags.csv

Edited by mister x

Share this post


Link to post
Share on other sites

After many trial and error tests, it appears the Notepad++ doesn't do something that Excel does when saving.  The .CSV file I saved with Notepad++ must be reopened and saved in Excel or it sees something odd at the last line.  

Fixed, did a compare with WinMerge and saw there needed to be an empty last line maintained in Notepad++ when saving to .CSV

Edited by mister x

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0