Application Architect Expressions

6 Posts
3 Users
0 Likes
45 Views
(@j.becker@pcvue.de)
Posts: 0
New Member Guest
 

Hello all,

I have following goal: I have to come from:

- DK2632.AS03.CGenP.Hybrid.Twr1.TIn

to:

- B'CGenP'Twr1'Tin

where the first string is the full-branch of an template-instance and the second one is a BACnet keyname.

In fact I want to seperate the communication-elements out of the Fullbranch or the FullName by using e.g. a prefix or parameters.

Does anybody has an idea?

Thank you in advance

 
Posted : 20/01/2016 2:30 pm
(@s.epaillard@arcinfo.com)
Posts: 0
New Member Guest
 

what about strreplace to replace . by '?
And you can use strright to take element on right of DK2632.AS03

 
Posted : 26/01/2016 8:26 pm
f.martin
(@f-martinarcinfo-com)
Posts: 148
Member Admin
 

And an even better solution.

string StrExtract(string String, char separatorChar, int Pos)
Returns a string that contains the substring of string parameter at the given zero based position (Pos) in string parameter that is delimited by one of the characters (separatorChars)
For example, if the current string is " My.name.is.John ", separatorChar is “.” and Pos is 1, the StrExtract method returns " name ".

Then the expression should work (I didn't try)

"B'" + StrExtract(Me.FullBranch,".",2) + "'" + StrExtract(Me.FullBranch,".",4)+ "'" + StrExtract(Me.FullBranch,".",5)

Read KB680 for further details, it's a goldmine 😉

 
Posted : 26/01/2016 9:39 pm
f.martin
(@f-martinarcinfo-com)
Posts: 148
Member Admin
 

Another solution, depending on how your templates are instanciated

"B'" + Me.TemplateInstance.Parent.Parent.Parent.Branch + "'" + Me.TemplateInstance.Parent.Branch + "'" + Me.TemplateInstance.Branch

or something like that...

 
Posted : 26/01/2016 11:00 pm
(@j.becker@pcvue.de)
Posts: 0
New Member Guest
 

Thank you all for your suggestions.
But they do not fit the goal. Now I think, that it is not really possible to solve it. The problem is, that the length of the branch can vary. so the communication objects can be everythere in the branch. I can not work with fixed indexes.

I would need something like a loop throught the single branches and check branch by branch, whether the node-type is an comm-object or a nav-object and use only the commobjects to build the communication-string.

something like:

e.g. for(i=0;i<=StrExcract(me.fullbranch).length,i++) {if(StrExcract(me.fullbranch,i).type == comm) then addToComString()};

But we don´t have loops :silly: 😆 :angry:

So I made another solution:

now I have a fix navigation part with a fixed length in the fullbranch, following by the communication part with a variable length. So I am able to remove the the nav-part in an expression.

the problem is, that I have now often redundant templates to build, because I have to rebuild the comm-part for every navigation - node. But it works now.

Again thank you.

 
Posted : 27/01/2016 3:51 pm
n.kunzer
(@n-kunzerarcinfo-com)
Posts: 1236
Member Moderator
 

Hi Johannes
I dont understand as the last solution given by Florent looked good and worked whatever the length of branch!

Nico

 
Posted : 27/01/2016 4:03 pm