Skip to main content
Question

Need help creating a child record identifier that is based on Parent Record +1

  • November 11, 2022
  • 0 replies
  • 159 views

I have a parent table (records within are Roadmaps, representing large-scale initiatives) and a child table (called Projects).  My goal is name create a numeric identifier for the child record based on the Roadmap #, adding '-1' to the first child, -2 to the second child and so on.  For example:
BIG INITIATIVE 600 (Roadmap record ID)
   600-1 Project Name A
   600-2 Project Name B
   600-3 Project Name C

I also want to automatically add a child record every time a Parent Record is added (and plan to build a Pipeline to achieve this).

Has anyone successfully done this?  If so, can you share your steps?  (eg is this two discrete actions or is there a way to include the 'RID=Parent RID, increment by 1' within the pipeline configuration?)

Thanks!

Renee​​

​

------------------------------
Renee Tumacder
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+12
  • Registered
  • November 11, 2022
Hhmmm … please be careful if you rely on the "-x suffix" for identification (relationships) since your counts could potentially change and have unexpected consequences if a child record were deleted.

Depending on your use case, it's possible to achieve this with the Formula Queries by counting child records having the same Parent where the child ID is less than or equal to the current child ID. For example, on the Child record you could create a "Formula - Numeric" field. Then, basically count siblings, like so:

// 7 is the Field ID of the Child::Related Parent
// 3 is the Field ID of the Child::Record ID#

var Number siblings = Size(GetRecords(
    "{7.EX.'" & [Related Parent] & "'} AND {3.LTE.'" & [Record ID#] & "'}"
));

$siblings​


Then, you'd create a "Formula - Text" field to concatenate the Parent and Child values together.

// Parent One 1-1 Child One

[Parent - Name] & " " & [Related Parent] & "-" & [Siblings] & " " & " " & [Child Name]


You can also head over to the Child's Advanced Table Settings and set the Record Title to the Formula - Text field above.

When you create the Child via Pipeline you mentioned you could set a static counter on the Child. First, you'd need to create a Summary field on the Parent counting its children. Then, in your Pipelines use Jinja to add one to the Summary count.

Does that help?