Post

1 follower Follow
0
Avatar

Format multiple referenced items in a calc field based on category

Hello,

I'm trying to create a calc field that shows something like "LASTNAME, Firstname" format, but I'll be getting the values from the actual item and some may come from a reference field.

I've got two text fields, namely Firstname and Lastname, a calc field Applicant, a category field named How many co-apps (a drop-down with choices from 1-10) and a relationship field Co-apps - inside the app that is referenced to this field also got 2 text fields, Firstname and Lastname.

If the user selects 1 from the drop down, Globiflow will create a new item and will reference it to the current item. That's when calc field needs to show:

If they have different lastnames:

CURRENTITEMLASTNAME, CurrentItemFirstname & REFITEMLASTNAME, RefItemFirstName

But if they share the same lastname, calc shall return:

LASTNAME, CurrentItemFirstname & RefItemFirstName

However, if the user chooses more than 2 Co-apps from the dropdown, things get a little more complicated.

If they have different lastnames:

CURRENTITEMLASTNAME, CurrentItemFirstname & REFITEM1LASTNAME, RefItem1FirstName & REFITEM2LASTNAME, REFITEM2FIRSTNAME

If they share the same lastnames:

LASTNAME, CurrentItemFirstname & RefItem1Firstname & RefItem2Firstname

That format will just repeat up to 10 referenced items.

Hope I make any sense at all.

Thank you :)

Lennie

Please sign in to leave a comment.