• ATTN Your Name, re:Re: Search & Replace

    From Nikki@21:1/5 to your.name@isp.com on Sat Jul 17 01:27:59 2021
    In article <h13ork$9pg$1@lust.ihug.co.nz>, Your Name
    <your.name@isp.com> wrote:

    "Christoph Kaufmann" <clk@tele2.ch> wrote in message news:1j1bjme.e5cchg17d94fwN%clk@tele2.ch...
    G. Adriaan Barthol <gabarthol@gmail.com> wrote:

    Mainly, I wish to generate two types of reports:
    1 - Test report (where the "keyword" is replaced by underscores)
    e.g. Hier soir, l'OM a _____ le PSG. beaten
    2 - Solution report (where the "keyword" is printed in an other colour
    in the sentence)
    e.g. Hier soir, l'OM a "battu" le PSG. beaten

    Make calculated fields for the test and for the solution sentences. Make the calculation "text result" and explore the text functions.

    Text functions will allow you to calculate how many words are placed
    before the keyword, and how many words are placed after the keyword. Knowing that, you can build the test sentence.

    In order to avoid complicated functions (with functions inside
    functions), you can use more calc fields or try the "let" function.

    Good luck.

    I don't know about changing the colour, but putting in the underscores is easy using the Substitute function in a Calculation field (no need for a Script).
    e.g.
    Test Sentence Calculation, Text Result, Unstored
    = Substitute(Sentence, Keyword, "____________")

    This will replace all occurences of the Keyword within the sentence with the underscores.

    If needed, you could use the Left function to replace the Keyword letters with the same number of underscore and space characters (to let people know how many letters the missing word has).
    e.g.
    Test Sentence Calculation, Text Result, Unstored
    = Substitute(Sentence, Keyword, Left("_ _ _ _ _ _ _ ", Length(Keyword) * 2 - 1))

    where the "_ _ _ _ _ " text contains enough underscore and space pairs to replace the longest possible Keyword.


    Ha! Your Name, Your Advice has seeded the future!

    Rather than simply ask a question I decided (being smart for once) to
    do a search, and the answer I needed was right there (or here), thanks
    to you. Perfect!

    I salute you, long after the (original) event as it is.

    Nikki

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Helpful Harry@21:1/5 to Nikki on Thu Sep 2 13:25:37 2021
    On 2021-07-16 15:27:59 +0000, Nikki said:
    In article <h13ork$9pg$1@lust.ihug.co.nz>, Your Name
    <your.name@isp.com> wrote:
    "Christoph Kaufmann" <clk@tele2.ch> wrote in message
    news:1j1bjme.e5cchg17d94fwN%clk@tele2.ch...
    G. Adriaan Barthol <gabarthol@gmail.com> wrote:

    Mainly, I wish to generate two types of reports:
    1 - Test report (where the "keyword" is replaced by underscores)
    e.g. Hier soir, l'OM a _____ le PSG. beaten
    2 - Solution report (where the "keyword" is printed in an other colour >>>> in the sentence)
    e.g. Hier soir, l'OM a "battu" le PSG. beaten

    Make calculated fields for the test and for the solution sentences. Make >>> the calculation "text result" and explore the text functions.

    Text functions will allow you to calculate how many words are placed
    before the keyword, and how many words are placed after the keyword.
    Knowing that, you can build the test sentence.

    In order to avoid complicated functions (with functions inside
    functions), you can use more calc fields or try the "let" function.

    Good luck.

    I don't know about changing the colour, but putting in the underscores is
    easy using the Substitute function in a Calculation field (no need for a
    Script).
    e.g.
    Test Sentence Calculation, Text Result, Unstored
    = Substitute(Sentence, Keyword, "____________")

    This will replace all occurences of the Keyword within the sentence with the >> underscores.

    If needed, you could use the Left function to replace the Keyword letters
    with the same number of underscore and space characters (to let people know >> how many letters the missing word has).
    e.g.
    Test Sentence Calculation, Text Result, Unstored
    = Substitute(Sentence, Keyword, Left("_ _ _ _ _ _ _ ",
    Length(Keyword) * 2 - 1))

    where the "_ _ _ _ _ " text contains enough underscore and space pairs to
    replace the longest possible Keyword.


    Ha! Your Name, Your Advice has seeded the future!

    Rather than simply ask a question I decided (being smart for once) to
    do a search, and the answer I needed was right there (or here), thanks
    to you. Perfect!

    I salute you, long after the (original) event as it is.

    Nikki

    No idea when I posted that (must have been a long time ago because the
    ihug ISP ceased to exist in 2008), but glad it still helps. :-)

    BTW, the easiest way to change the colour of the answer would simply be
    to use a separated question and answer fields coloured appropriately
    and place on the layout where required. I should have thought of that
    very simple option originally.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)