Concatenation of strings — Round 2
This post is the continuation of the previous post of mine on the same topic.
In the last post, I was discussing a requirement which is very specific.
When I shared the post with my colleagues, they want to rework it towards a generic requirement. Feel free to check out here.
A short story: I used Variants, yes a very old datatype in NAV, developers never ever wanted to use it unless someone asked them to use! Thank you Rasitha Chandrasekara for the valuable tips.
Code next…
The first part of the code will have the necessary filtration of the Item master table. Then the function call happens with appropriate parameters.
The second and last part of the code will be the function itself. Let’s jump in.
The first part of the code…
The second and last part of the code…
The second part of the code actually does the concatenation with the parameters you passed in. Since the first parameter is Variant, you can pretty much pass anything.
I have done it for records only, hence, I used RecordRef.GETTABLE() to retrieve the Item Table. The sign can be a pipeline(|) or an and(&) or even double periods(..) if you use it appropriately.
The blog post ends right here, but there are some interesting facts, and those will follow.
#TIL: You can only pass by value, not pass by reference when you are passing record variables as variants.
When I try to concat a Code and a FieldRef, the compilation error message is bit funny.
That’s coincidence because my PC wallpaper is featuring Joker!