Announcements
I am disappointed to find that a FlowField cannot use a small amount of CAL code.
I am trying to calculate a substring of a UK Postcode on the Customer table, e.g.: AB12 3CD -> AB12
I have done this outside NAV in Excel reports by: PostcodeDistrict = Delete3CharsFromTheEnd(StripSpaces(Postcode))
What is the best way to do this in NAV to act just like a FlowField? In other words:
Thanks!
(For anyone wondering, I did it this way because the first part is not a fixed length.)
*This post is locked for comments
If you add the variable to the Page and add the variable to the page just like you would a field, and the Web Service exposes the Page object, then you will see the variable just like any field. Sounds like that will hit your needs. Hope that helps!
Would the variable be defined on the Page or the Table?
And once I added it to the page, would the Web Service (based on that page) automatically get that variable?
Thanks for the reply Jeremy.
I prefer your first variable solution over creating and updating a new database field, since the data is already in the database.
Sadly, you just can't put code logic or even functions into FlowFields.
Generally, you'd have to, on the Customer Page and in the Web Service you're exposing, set a variable, populate that variable with your logic during OnAfterGetRecord, then add the Variable to the page.
Given the nature of the challenge you have, what you *could* do is make a new field that contains only the data you want. Then, a quick bit of additional validation on the field when it changes to update the new PostPrefix field, along with a one-time run Processing Only routine that populates the data initially.
Then you can do FlowFields all over the place against it.
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156