Numbered messages in CAPI questions text

What would you like to see in CSPro?
Post Reply
AriSilva
Posts: 615
Joined: July 22nd, 2016, 3:55 pm

Numbered messages in CAPI questions text

Post by AriSilva »

Hi folks,
I tend to write all the program messages in the mgf file.
I think this is good programming standards.
The numbered messages can be used directly on errmsg and maketext, that is very good.
1. But a message number cannot be used in an ACCEPT command. Why not?
2. A message number cannot be used also in the CAPI questions text. I know this is a little be difficult to write as far as the syntax is concerned, but why not?
Best
Ari
Best
Ari
Gregory Martin
Posts: 1845
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Numbered messages in CAPI questions text

Post by Gregory Martin »

Those features just haven't been implemented as no one has requested them to date. Most users don't use the message file unless they are doing batch edits, in which case you don't usually use accept and there is no CAPI text. However, with multiple language message files, more people may use these numbered messages.

You can do things like this:
accept(maketext(10001),...);
Or, in CSPro 7.1, you can shorten it like this:
accept(tr(10001),...);
AriSilva
Posts: 615
Joined: July 22nd, 2016, 3:55 pm

Re: Numbered messages in CAPI questions text

Post by AriSilva »

Thanks, Greg,
I´ll use this maketext trick (I should have thought about that, my fault).
Maybe I could use the same trick for the captions in the qsf, although it would give me a little more work to create one or more auxiliary variables in the preproc (or on focus) with the maketext, and then put their names in the qsf.
What do you think about that? Is it worthwhile, or should I leave the messages directly in the qsf as it is now? What is your experience?
Best
Ari
Best
Ari
Gregory Martin
Posts: 1845
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Numbered messages in CAPI questions text

Post by Gregory Martin »

In CSPro 7.1, you can use a function in the CAPI text in the same way that you use variables. So your text could be something like this:

%GetCapiText%

With a function:
function string GetCapiText()

    GetCapiText = "Dynamic CAPI text!";

end;
I'm not 100% sure, but I think that getsymbol() will give you the proper value, so you could use that function to determine what text GetCapiText should return. So it might look like:
function string GetCapiText()

    if getsymbol() = "FIELD1" then      GetCapiText = maketext(1001);
    elseif getsymbol() = "FIELD2" then  GetCapiText = maketext(1002);
    else                                GetCapiText = "<unexpected error>";
    endif;

end;
Post Reply