VLFOne - Messaging via Message File

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
UrriahAguilera
Posts: 3
Joined: Wed Feb 08, 2017 3:20 pm

VLFOne - Messaging via Message File

Post by UrriahAguilera » Fri May 24, 2019 1:52 pm

Greetings everyone,

I’m working on a project where we are converting a VLF Win application into a VLF One version. I would like to ask how you guys handle generating client side messages when messages are stored in an message file? Currently im manually writing an identical message, but if I can use the message file as how the VLF Win component does it, that would be better.

Thanks and have a nice day!

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Fri May 24, 2019 1:59 pm

Could you post some code examples of how you issue messages in the VLF-WIN application?

UrriahAguilera
Posts: 3
Joined: Wed Feb 08, 2017 3:20 pm

Re: VLFOne - Messaging via Message File

Post by UrriahAguilera » Fri May 24, 2019 5:09 pm

this is how the VLF Win handles sending messages. the message file is found in the iSeries server.

Image

and this is what i did, i just hard coded the message description and used avIssueMessage

Image

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Mon May 27, 2019 10:51 am

Thanks. Got it now.

The fundamental issue is that the MESSAGE command is not supported in VL-Web code.

To issue client side messages you need to use "text" instead of a message numbers and message file names.

One thing to consider is that LANSA can emulate IBM i message files using a database table LX_MSG.
That's why MESSAGE MSGID(XXXXXXX) MSGF(YYYY) commands works in VL windows client or server contexts.

So it might be possible that you could put together a server module that is called at the start up your application that reads a message file and sends the details to a singleton reusable part in your VL-Web client. That reusable part could then have a #MYPART.MESSAGE MSGID(XXX1234) MSGF(YYYY) method that you could use in your client code - making the code very similar to your VLF-WIN code.

The 2 key questions for me would be:
- Is the effort to set this up worth the reward> e.g. Do you tens of messsages or hundreds or thousands?
- What's the overhead of transferring the message file to the VL-Web client at start up time (or at time of first access).

WDYT?

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Mon May 27, 2019 12:02 pm

BTW - This is not a VLF question really, the issue and the potential solution apply to all VL-Web based application, whether they use the VLF or not.

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Wed May 29, 2019 9:22 am

If you have a server module call involved in this logic then it might be another simpler way to solve this.

Issue the required MESSAGE operations in the server module.

Then in the client VL-Web code use #avFrameworkManager.avReceiveSystemMessageQueue Requester(#Com_Owner) to receive all messages returned from the server module call and route them into the VLF’s visible message area.

chriskarge
Posts: 3
Joined: Wed May 25, 2016 10:28 pm

Re: VLFOne - Messaging via Message File

Post by chriskarge » Thu May 30, 2019 12:23 am

Howdy! The issue is more involved than just the MESSAGE command. Urriah is working on redeveloping some of the ERP Framework VLF-Win components as VLF-One. In the client components in VLF-Win, we largely reused substantial amounts of LANSA 5250 code in the initial development, so we have a quite a bit of client-side validations of user input, etc. The list below shows the commands used in client-side components. So, any guidance on mass-replacement of such code?

UPPER ( CMD ) REFERENCES MSGIDS
CALLCHECK 5 3
CONDCHECK 110 50
DATECHECK 359 25
ENDCHECK 3 1
FILECHECK 209 87
MESSAGE 2,706 345
RANGECHECK 1 1
SET_ERROR 1,878 455
USE 461 270
VALUECHECK 47 23
- 5,779 1,107
******** End of data ********

Thanks,
Chris

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Thu May 30, 2019 2:03 pm

Interesting.

I’d have a think about, and maybe experiment with, using a structure where you can run (reuse) code like that in server modules.
There’s no problem getting overall error status and messages back to the client but associating the errors with fields on the form might be problematic.

Since the code started out as 5250 code, how did you associate the errors with fields in the VL-Windows version?

Also, where the validation rules are applied to the fields in the repository or to fields in database tables, rather than in code, then they can be often run at the client semi-automatically. See https://docs.lansa.com/14/en/lansa016/p ... lidate.htm

chriskarge
Posts: 3
Joined: Wed May 25, 2016 10:28 pm

Re: VLFOne - Messaging via Message File

Post by chriskarge » Fri May 31, 2019 12:28 am

Howdy! Thanks for the info on the .Validate method; it may come in handy in the future. For the short term, more than half of the code that specifies a message file are validation commands inside a Begincheck/Endcheck block (Set_Error, DateCheck, etc) so associating the error with the field in VL Win was auto-magic. Of these, many of the validations are ensuring the user provides valid input before allowing some operation within the system, so they aren't necessarily associated with any file/field, so we are not doing an Insert, Update or Delete.

Would it be possible for VLF-One to preload the contents of any message files nominated in the Partition Multilingual Attributes, and then allow the existing RDML commands to pull the message text from there? I know this would be a modification, but it would provide greater support for existing LANSA application code. This obviously doesn't help for non-ML partitions, but who uses those!? :-) Just a thought...

We could obviously do something similar on our own (preload the message file contents into an internal structure), but then we would need to emulate the handling of the substitution variables, etc.

Thanks,
Chris

MarkD
Posts: 630
Joined: Wed Dec 02, 2015 9:56 am

Re: VLFOne - Messaging via Message File

Post by MarkD » Fri May 31, 2019 12:37 pm

You should be able to do this right now fairly easily.

Import the attached material into your partition.

Compile only the I/O module for LANSA internal table LX_MSG.

Then compile all the other parts.

On your PC execute VL-Windows form MSG_FORM to copy all the English messages from message file DC@M01 into a tab delimited file in your partition execute folder.

Now run VL-Web form MSG_TESTER to try out looking up messages in VL-Web applications. For example, ADW0001 or DCU0001.

The key part is MSG_MANAGER, which can find a message by its MSGID and handle up to 3 substitution variables.

On first call it invokes server module MSG_LOADER to return the list of messages from the tab delimited file.

As supplied this solution does not require the VLF to be used, so you would probably change it to that the MESSAGE method in MSG_MANAGER used #avFrameworkManager.avIssueMessage as well as optionally returning the message text.

You should be able to change the code fairly easily to work with your application message file(s) instead of LANSA's DC@M01, which has 6000+ messages in it.

There’s a few things worth nothing:

• Using Scope(*APPLICATION) when declaring MSG_MANAGER is really important so that you only ever get one instance of it.

• MSG_FORM, which creates the tab delimited file of messages, is only required on a developer’s system. It’s only the tab delimited file of messages that is required on production systems.

• You can get any IBM I message file (*MSGF) into table LX_MSG on your development PC by exporting the message file via the 5250 LANSA export facility and then importing it into your PC in the usual way.
Attachments
QuickExport20190531121916.zip
(19.27 KiB) Downloaded 13 times

UrriahAguilera
Posts: 3
Joined: Wed Feb 08, 2017 3:20 pm

Re: VLFOne - Messaging via Message File

Post by UrriahAguilera » Thu Jun 06, 2019 3:19 pm

thanks for the feedback Mark

Post Reply