hexagon logo

IF_GOTO/C1.INPUT and multiple languages...

OK, I'm stumped (not really, but I would like a general solution).

If I have an IF_GOTO/C1.INPUT == "YES" in my program, it will break when I change PC-DMIS to Swedish.

So, I can write IF_GOTO/(C1.INPUT == "YES") or (C1.INPUT == "JA") to make it work in English and Swedish (and some more, like German).

But how do I write to have it work in the current language PC-DMIS is set to, whatever language that is?

In the Report Editor there's a function LOADSTR(xyz) which can get the current translation of string #xyz, but that doesn't work in a part program.
  • The question is very relevant and current.

    There must be a resource string somewhere you can use?
    Something like IF_GOTO/C1.INPUT == RESSTR(47) with RESSTR(47) in this case is "YES" in whatever language PC-DMIS is running currently.
    Maybe there's a list of these resource strings?
  • Well, the LOADSTR() function already exists, but it only works in the Report Editor - why not just make that one available in part programs too, and document the most important numbers?

    Quoting the Help:

    Loading Strings from PC-DMIS

    Similar to how you can change the text color for a cell in the "Changing Expression Text Color" topic, the Reporting expression language lets you pull strings from PC-DMIS's current running language by using this expression:

    =LOADSTR(<integer expression>Wink

    This function takes a single parameter, an integer number that corresponds to the value of a string located in resource.dll or strings.dll.

    A positive number pulls the string from the resource.dll file.

    A negative number pulls the string from the strings.dll file.

    If you type this function in the Cell Expression box (or cell) of the GridControlObject, click OK, and then click outside of the object. PC-DMIS evaluates the expression and returns the string assigned to the specified integer value.





    As a sidetrack, I found this [very] hackish solution, which relies on the two words "YES" and "NO" existing in the right place in the COMMENT/YESNO command (FULL_SCREEN=NO, AUTO-CONTINUE=YES):

    C1         =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=YES,TIME DELAY=0,
                Svara JA eller NEJ!
                IF_GOTO/C1.INPUT==GETTEXT(185, 0, {C1}),GOTO = SVAR_NEJ
                IF_GOTO/C1.INPUT==GETTEXT(450, 0, {C1}),GOTO = SVAR_JA
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade något annat än "JA" eller "NEJ"
                GOTO/****
    SVAR_JA    =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "JA"
                GOTO/****
    SVAR_NEJ   =LABEL/
                COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
                Du svarade "NEJ"
                GOTO/****
    ****       =LABEL/
  • Hey, that's pretty creative. You could call it hackish or you could call it making the most of available resources!
  • Hey, that's pretty creative. You could call it hackish or you could call it making the most of available resources!


    Frugal programming Slight smile, very nice!

    Coffee's working this AM, eh?

    TK
  • Try tis it should work in any language.


    ASSIGN/V1="YES"
    ASSIGN/V2="NO"

    C1 =COMMENT/YESNO,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    ASK YOUR QUESTION

    IF/C1.INPUT==V1
    GOTO/L1
    END_IF/
    IF/C1.INPUT==V2
    GOTO/L2
    END_IF/
  • Unfortunately not, as /YESNO returns the text JA/NEJ in Swedish, not YES/NO. If it had only returned 1/0 instead, everything had been good.
  • Try this (you have to use INPUT type of comment):

    C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
    Svara JA eller NEJ!
    1-YES (JA), 2-NO (NEJ)

    IF_GOTO/C1.INPUT=1,GOTO = SVAR_JA
    IF_GOTO/C1.INPUT=2,GOTO = SVAR_NEJ
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Du svarade något annat än "JA" eller "NEJ"
    GOTO/****
    SVAR_JA =LABEL/
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Du svarade "JA"
    GOTO/****
    SVAR_NEJ =LABEL/
    COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,
    Du svarade "NEJ"
    GOTO/****
    **** =LABEL/
  • Thanks - yes, I know that; my main point was that PC-DMIS has a standard YES/NO question that works in all languages, but the returned result is language specific and there is no standard way to get the language specific "YES" and "NO" strings to compare with, making the YES/NO dialog worthless when your installation has more than one language available (and every non-English installation also has English available).

    If only the YES/NO dialog had returned the same strings irrespective of the current language (for example "YES"/"NO" or "1"/"0") all had been well...
  • Maybe this is more work than it's worth, but what about using the Form Editor to create a form with bilingual instructions. I'm thinking two text boxes side by side, English/Swedish. The user input can be done with Radio Buttons. RadioButton1.Text="Yes/Ja" , RadioButton2.text="No/Nej".

    Then when the form closes, your flow controls will rely on the value of the RadioButton selection (1 or 2).
  • I'm sure the original intention was to have an accommodation that was useful for any language installation, not one that is specifically derived on one. Like stated, instead of a yes/no function pulling the respected "YES" or "NO" based on the current language to be comparable to a universal string of "YES"/"NO" or a 1 or 0, or a 1 or 2. We are left with language specific answers that have to be compared to language specific strings.

    If I understand this correctly.