Set Component value based on a values of two custom fields

Issue #160 resolved
George A created an issue

Hi,

I'm struggling the last 2 days to automatically set the Component field based on the values of two single value custom fields.

For example:

Selected Custom Field 1: "A" Selected Custom Field 2: "B"

Component should be assigned as "A - B"

Value "A - B" is valid and exists for the component.

I tried several options using "Copy a parsed text to a field" but couldn't make it work.

Any help would be highly appreciated.

Thanks, George

Comments (7)

  1. Fidel Castro Armario repo owner

    Hi George,

    You should use the following configuration:

    conf-1.png

    Text to be parsed used is:

    %{12900} - %{12901}
    

    IMPORTANT: Beware not to insert undesired whitespaces.

    Note that:

    • %{12900} is field code for A
    • %{12901} is field code for B

    Once configured, post-function looks like this:

    conf-2.png

    An example of the result:

    conf-3.png

    These are the components in the project:

    conf-4.png

    Regards,

    Fidel

  2. George A reporter

    Many thanks Fidel for the prompt detail reply. It turned out to be a stupid mistake of the hyphen defined under the components and the one used in the rule. Component was defined as A – B and in the rule I used: A - B. The difference between – and - costed me 2 days of my life :)

    Regards, George

  3. George A reporter

    Since you ask... one last thing. I would like to add an IF-THEN-ELSE condition as well when returning the Component value. However the below doesn't work (11252 and 11253 are the custom single value fields). Any ideas?

    %{11253} != "" ? %{11252} - %{11253} : %{11252}
    
  4. Fidel Castro Armario repo owner

    You should use of advanced parsing mode and one of these expressions:

    %{11253} != "" ? %{11252} + "-" + %{11253} : %{11252}
    

    or

    %{11253} != null ? %{11252} + "-" + %{11253} : %{11252}
    

    Both expressions are equivalent.

  5. Log in to comment