Hi there AppWorks fans,
Welcome to a new installment of AppWorks tips.
New week, new chances, new insights, and a nice feature explained on multiline fields; updated through BPM. Hard to do? This depends! Not with the insights on this post. This is a typical feature in BPM-expressions-land which I saw passing by in my own project! The BPM-godfather of AWP (you know who you are!) learned me this trick with a walk-through session…Time for our own “Walk-through”…
Let get right into it…
Spin up your favorite platform and login with a developer account (in my case
awdev through OTDS) in design-time. Hopefully you already have a nice workspace with corresponding project in place (incl. a nice folder structure with an
Create an entity
project with one property
prj_name of type ‘Text’ (not ‘Long text’). Generate all the default BBs and make sure to “brush-up” the entity, so it is pre-publishable (you know the drill…right?):
Once the entity is ready, we make sure to update the type of the
prj_name property in the presentation options for the ‘Create’ form:
Next step is to add the ‘Web service’ BB and expose the ‘Update’ operation. After this, we can save the entity and do a first publication into runtime.
Because of the webservice exposure, we are required to create a new service container. The container is of type ‘Application Server Connector’, and we create this in the ‘System Resource Manager’ artifact.
Use this input during the ‘New Service Group Wizard’:
- Group name:
- Mark the ‘Web Service Interface’:
Method Set Entity project
- Service name:
- Startup type:
- Mark and select the option ‘Assign OS Process’
First create a new ‘Project’ entity instance in runtime (just with our developer account…It’s fine). Make sure to copy the ‘ItemId’ from the runtime URL when you view/open the entity instance. This is my id:
Now open the ‘Web Service Interface Explorer’ artifact, find the ‘Updateproject’ service, and run a first test with input like this (watch the
Refresh runtime for a view on the result:
The fun part of the post! 😁
For this fun part we start with a new BPM with the name
bpm_dummy; nicely saved in the
bpms folder of the project. Make it simple with just one activity! Right-clicking the activity lets you insert it with a webservice operation which will be our exposed ‘Updateproject’ service. This is our start point where we opened the entrance for playing with expressions from the message-map point of view:
Let’s start simple with the same call we did with the service test tool (just ‘hard-coded’ values…It’s fine for our demo):
Save it all, publish it, and do a first run directly from the model overview panel with the
<F12> key (use
<F9> to trigger a validation/build action!). View the entity instance in runtime and make your conclusion! Yes, it works the same! 🙃
The next step is to make it smarter! What if these values are not static, but a retrieved from properties in the XML tree!? Yes, my friends…How to still glue data together and place it on a new line? Well, that’s the power of expressions; with a particular function by the name of
Have a look at this expression:
concat('line1', chr(9) ,'tab1', chr(10), 'line2', chr(9) ,'tab2', chr(13), 'line3', chr(9) ,'tab3'). Does it do exactly the same with all the manual
<Space>‘s? Hell yeah it does! Let’s try it out and make sure to set the correct usage on the input (don’t forget to save and publish!):
Niceeeee! If this is possible, what else is possible? Have a look at this ASCII-list for other characters to use.
Keep in mind the “extended” ASCII-codes are not supported!
That’s it; A quick and efficient ‘DONE’. It gives a new insight on expressions in the BPM layer of the AppWorks platform. Next to the
chr() function in this post there is much more to explore at functions-level in the expression editor…Nice stuff, but for another time or for yourself to try them out! Get yourself familiar with the concept of expressions as it’s an underestimated peace of the cake from the platform! Have a great expressions-week-end, and I see you in the next great post on AppWorks Tips.
Don’t forget to subscribe to get updates on the activities happening on this site. Have you noticed the quiz where you find out if you are also “The AppWorks guy”?