Grooper 21.00.0082 is available as of 12-12-2023! Check the  Downloads Discussion  for the release notes and to get the latest version.
Grooper 23.00.0042 is available as of 03-22-2024! Check the Downloads Discussion for the release notes and to get the latest version.
Grooper 23.1.0018 is available as of 04-15-2024! Check the  Downloads Discussion  for the release notes and to get the latest version.
Options

How do you pull the value of a text field from another field?

Can I use a Default Value Expression or some other solution to pull a text value from a parent object's Data Field value?

I see examples of how to pull an integer value from a parent object using Calculate Expression (ParentInstance.ParentSection.Tables("SourceTable").SumOf("SourceColumn") but Calculate Expression only works for integer values so I assume I need to use a Default Value Expression.

*The data field value I need is not nested in a table.  It is just a member of the data model.

Answers

  • Options
    rmccutcheonrmccutcheon Posts: 756 ✭✭✭
    @GrooperGuru what are your thoughts?
  • Options
    GrooperGuruGrooperGuru Posts: 481 admin
    Calculate expressions should be allowed with non-numeric fields, however, I believe that was not the case prior to 2.7. Been quite awhile since I've worked in 2.6, so my memory is a little fuzzy. @ThunderMenOKC what version of Grooper are you running right now?
    Matt Harrison
    Product Manager
    mharrison@bisok.com
  • Options
    2.70.0019
  • Options
    GrooperGuruGrooperGuru Posts: 481 admin
    @Brian or @Ryancan you help out here? I tried to find a solution, but my VB skills are embarrassingly weak.
    Matt Harrison
    Product Manager
    mharrison@bisok.com
  • Options
    BradleyBradley Posts: 94 ✭✭✭
    Add this to the Calculate Expression property of the child field, replacing "Parent Field Name" with the name of your field higher up in the data model:

     ParentInstance.DocumentInstance.FindChild("Parent Field Name", True).Value

    This will work from any level in the data model. I tested it from various levels within the data model.

    The above solution will work in this scenario but I'm wondering if we could give you an easier solution than needing to script the value into the field. One of us may be able to offer an alternate solution based on your extraction goals.

    What is it that you are trying to accomplish by referencing a parent field? Please provide a screenshot of your data model if you'd like a few suggestions from us.

    Grooper on! :)
  • Options
    Thank you for all the help.  Here is some more background.  

    I have an import watcher picking up emails from a mailbox.  Each email has attachments (PDFs and Excel documents).  My goal is to take the subject line of the email and tie that value to each attachment, so when I do a document export each attachment has a metadata file with containing the email subject line as a value in the metadata file.  These files will be consumed by a downstream application.

    Currently, I am successfully picking up the email via the import watcher and I am extracting the email subject into a field that I am calling "API_Number".  I am using the following Default Value Expression to extract the subject from the email: DirectCast(Handler, MailMimeTypeHandler).Subject into API_Number.  This is working perfectly.

    I am now attempting to assign the value in API_Number to all of the email attachments / sub-elements below the email object.  Actually, the way I am approaching solving this is to pull the API_Number value from the root object / email's API_Number into a data element on each attachment. 

    When I use the script you provided ( ParentInstance.DocumentInstance.FindChild("API_Number", True).Value) in a calculate expression.  It sets the value of "ParentAPI" field to the value of API_Number on the email object (both fields on the same object), but it does not set the value on the attachments (child objects of the email). 

    See pictures below showing the data being extracted on the email object, but not on the attachments / child objects:

     

    Thank you.  I am also open to other ways of solving this.
  • Options
    jlunsfordjlunsford Posts: 138 mod
    What would be a calculate expression to populate a field on level 2 with a value from the parent folder.
  • Options
    rmccutcheonrmccutcheon Posts: 756 ✭✭✭

    Try this

    Variable = SumFieldInstance("Parent name\child level 1 name\child level 2 name\variable name") + SumFieldInstance("Parent name\child level 1 name\child level 2 name\variable name")


  • Options
    BradleyBradley Posts: 94 ✭✭✭
    @jlunsford Use the same expression that is in my post above. It should work for your question too.
Sign In or Register to comment.