Search code examples
peoplesoft

Is there anything like MessageBox/SQL binds for normal strings?


Context

In PeopleCode, the following declaration with MessageBox is valid:

MessageBox(0, "", 0, 0, "Something = %1, Something else = %2.", &something, &somethingElse);

This allows me to use bind variables for the MessageBox. The same is also true with SQL:

SQLExec("SELECT * FROM %Table(:1) WHERE VALUE = :2", Record.Y_SOMETHING, &value);

Question

Is there a way to do that with normal strings? I've never liked having to "pipe" strings together like this &string = Something = " | &something | ", Something else = " | &somethingElse | ".".

Is there a way to use this format for regular strings? I've looked through various of Oracle's PeopleBooks, but I haven't found anything.


Solution

  • Maybe this is what you are looking for:

    Local number &message_set, &message_num;
    Local string &default_msg_txt = "%1 %2 %3";
    Local string &l_result= MsgGetText(&message_set, &message_num, &default_msg_txt, "hallo", "Frank", "!");
    

    result:

    "hallo Frank !"
    

    You can use MsgGetText function to determine a message by message catalogue. In case the message is not found, the default text is used.