# Default and Unique Fees to be entered automatically for each Clinician

Topic Labels: Automations Data Formulas
Solved
1038 2
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Hi there

I am hoping you can help me.

I need to automate Clinician Fees in Airtable according to the Insurance company and whether the patient is a clinic (default fee) or practitioner's own patient (unique).

Will it be easier to do an Automation or Formula and how would you do that?

Thanking you in advance for the help.

1 Solution

Accepted Solutions
12 - Earth

Hi,
I would use a formula.
IF({Company1 Own Patient},{Company1 Own Patient},
IF(Company2 OwnPatient},{Company2 ....

and so on, depending on the priority of fields
You can write smarter and shorter solutions depending on decision logic, for example if you know that only one 'Own patient' filled,  you can get a result as
IF(CONCATENATE({Field1}, {Field2} ... etc), CONCATENATE({Field1}, {Field2} ... etc),
IF(

Also, you can use this mini-script to get a table of field names, divided by 'Own/ not own', paste it in temporary table and use a formula to create a formula ))

``````const own=name=>name.includes('Own')
const flds=base.getTable(cursor.activeTableId||'').fields.map(f=>f.name.toString()).sort()
output.text([...flds.filter(own),...flds.filter(n=>!own(n))].join('\n'))``````

2 Replies 2
12 - Earth

Hi,
I would use a formula.
IF({Company1 Own Patient},{Company1 Own Patient},
IF(Company2 OwnPatient},{Company2 ....

and so on, depending on the priority of fields
You can write smarter and shorter solutions depending on decision logic, for example if you know that only one 'Own patient' filled,  you can get a result as
IF(CONCATENATE({Field1}, {Field2} ... etc), CONCATENATE({Field1}, {Field2} ... etc),
IF(

Also, you can use this mini-script to get a table of field names, divided by 'Own/ not own', paste it in temporary table and use a formula to create a formula ))

``````const own=name=>name.includes('Own')
const flds=base.getTable(cursor.activeTableId||'').fields.map(f=>f.name.toString()).sort()
output.text([...flds.filter(own),...flds.filter(n=>!own(n))].join('\n'))``````

5 - Automation Enthusiast

Thank you very much 🙂