So I have some code inside a code-stage in BP and it works.
The problem is that it is clunky, long and fragile. I would like to know how could I maybe use a class/es in BP to refactor this code into something more concise and scalable, without having to write an external class-library and then refer to it (this is not so easy to do in my environment).
I know it is possible to write methods using the Global Code tab, but could I write an abstract class there? and where would the sub-classes go? How about interfaces? Apologies if this is too basic, I could not find anything previous to guide me on this. Any help or pointers are appreciated, thank you.
The code is a basic decision stage that uses input from data item "Main_Segment" and uses local (private) variables "parcel_label" and "found" to output some static values into BP data items "Parcel_Label" and "Found".
(BP Data Item) Found = (Local variable) found
(BP Data Item) Parcel_Label = (Local variable) parcel_label
(BP Data Item) Main_Segment = (Local variable) segdescript
string segdescript = Main_Segment; found = false; parcel_label = ""; if (segdescript.Contains("Segment 001") || segdescript.Contains("Segment 101")) { found = true; //if first condition is met, assign value of true to "found". if (found = true) //as "found" is now true, the assignment below is carried out. { parcel_label = "Parcel0000"; } } //and again... if (segdescript.Contains("Segment 002") || segdescript.Contains("Segment 202")) { found = true; if (found = true) { parcel_label = "Parcel1111"; } } //and again another 97 times...zzz