Text parsing FAILS: parsing never even occurs- the code itself gets posted into custom field

Issue #156 resolved
Andy Keyworth created an issue

I'm trying to make use of the text-string parsing functions in a post-function to strip out some characters from one field's contents, and then paste the resulting "cleaned up text" back into the same field. But for some reason the text parsing never happens, and the function/code statement itself gets pasted into the field. What do I have to do to AT LEAST get the function to work?

We have a field called "Transcriber Email Address" (cf %{18700}); for some reason, some of the email addresses in it will be prefaced by "c--". I want to remove these characters if they are present, and paste the resulting substring back into the same field. I've used the following post-function: "Copy a parsed text to a field", set to both Basic and Advanced parsing, and in the text box tried the following functions: [using a conditional] substring(%{18700}, 0, 2) = "c--" ? substring(%{18700}, 3, endindex-1) : %{18700} [and, using another function] replaceFirst(%{18700}, "c--", "")

But no matter what I try, the EXACT function/code statement above gets pasted into the box. Why is this happening? I don't see any other area to specify, "hey, use the text-string functions".

Comments (4)

  1. Andy Keyworth reporter

    Please disregard; I found that this is only possible in Advanced mode. I hadn't seen the (admittedly not obvious) link to how to get parsing to work the way I wanted.

  2. Fidel Castro Armario repo owner

    Hi Andy,

    Then, you got it working as you need, right?

    I think that the simplest expression to achieve your needs is:

    replaceFirst(%{18700}, "^c--", "")
    

    where ^ means beginning of input.

    By the way, version 2.1.33 provides a new post-function called "Parse field for extracting data" which can be used to easily parse data fragments from fields.

    Regards.

  3. Andy Keyworth reporter

    Thank you for your explanation- yes, I finally got it working as I need. Though I may well make use of the post-function you described.

  4. Log in to comment