3 Replies Latest reply on May 30, 2012 10:38 PM by Frank.Hampshire-Oracle

    Concatenation of Text attribute of an Entity

    940348
      Hi All,

      I have a project requirement that a text attribute for all the instances of an entity needs to be concatenated and the final concatenated string should be set at parent entity level.

      As a working of InstanceSum, which sum the number attribute of all the instances of an entity and set at parent entity level, I need a same function for text attribute for concatenation.

      Kindly help.


      Thanks,
      Malav Shah
        • 1. Re: Concatenation of Text attribute of an Entity
          Ben Rogers
          Hi Malav,
          As you say, there is no InstanceSum() for text attributes. It's quite an unusual requirement, but I have a couple of suggestions that may help:

          *(1) out of the box:*
          this all depends on how many instances of the child entity you will have. it's not a particularly elegant solution but it will work.
          "hard code" some "slots" on the parent entity, and give each child entity a sequential ID number

          Such as:

          the parent's 1st child entity text = InstanceValueIf(the children, the child's text, the child's id=1)
          the parent's 2nd child entity text= InstanceValueIf(the children, the child's text, the child's id=2)
          the parent's 3rd child entity text= InstanceValueIf(the children, the child's text, the child's id=3)
          the parent's 4th child entity text= InstanceValueIf(the children, the child's text, the child's id=4)
          ... up to the maximum number you can expect for the child instances.

          Then it will be fairly simple to build the parent string.
          You would need to link it to the instance count of the child entities, in a word rule table or in excel:

          if the parent's child instance count = 1 then
          the parent's text = the parent's 1st child entity text

          if the parent's child instance count = 2 then
          the parent's text = the parent's 1st child entity text & the parent's 2nd child entity text

          if the parent's child instance count = 3 then
          the parent's text = the parent's 1st child entity text & the parent's 2nd child entity text & the parent's 3rd child entity text

          Because you don't want it to come out as unknown.

          I did say it wasn't elegant but it will work, and it is "out of the box" :-)


          *(2) custom inference listener:*

          You could write a custom inference listener which loops through all of the entity instances, builds a string, and then assigns it to a parent-level attribute. You would need a "trigger" for it to run, such as "the parent's children have been provided = TRUE". It shouldn't be too complex to write this, but then the problem is you have to maintain it in the future and it is custom code, so it all depends on your client requirements.

          Just some suggestions to think about. Hope it helps.
          Thanks
          Ben
          1 person found this helpful
          • 2. Re: Concatenation of Text attribute of an Entity
            940348
            Hi ben,

            Thanks for response.

            It helped a lot.

            Regarding the 1st solution I am not aware that how many instances I can have, so I have not tried it.

            But, I have built event handler for it as you said(2nd solution).

            However, to maintain such custom code and upgrading is difficult and may cause several issues.

            That's why I am looking for any out of box functionality which can fulfill the stated requirement.

            Many Thanks.

            Regards,
            Malav Shah
            • 3. Re: Concatenation of Text attribute of an Entity
              Frank.Hampshire-Oracle
              There really isn't any inbuilt functionality for this. The only way to achieve this would be with a custom function http://docs.oracle.com/html/E29403_01/toc.htm