Skip to main content
Solved

Create new record in table based on conditions in other table

  • May 13, 2020
  • 1 reply
  • 9 views

Forum|alt.badge.img+4

Hello!

I’ve got a few questions that I’m having a hard time figuring out the best approach to solve or if it can be solved easily (very much not a JS person)… I want to create a record in a table based on conditions from the original table. The new record should copy information from the original table that are held as different field types.

Something like this:

Conditions for new record:
If xTeam is in thisField, then create new record in otherTable

Data to be copied:
thisTable.launchDate = otherTable.liveDate
thisTable.activityDescription = otherTable.description
thisTable.launch = otherTable.launch --> (this is currently a lookup between the two tables where otherTable looks up thisTable)
thisTable.activityOwner = otherTable.requestor --> (this is currently a lookup from a 3rd table)

write otherTable.status as request

Is this feasible in the scripting block? and are there any good examples/resources on the types of functions to write to execute this?

I’m also concerned about duplicate records, I would want to run this script weekly - is it possible to only run a script on a particular view (e.g. filtering for records created within a certain time period)

Best answer by kuovonne

This is quite possible with scripting block.

When you get the records from thisTable, you can get records from only a specific view. Use SelectRecordsAsync on the view instead of the table.

Are the lookup values the ones that will change field type? What is the new field type? You might have to play around a bit to get the lookup values in the format you want. The documentation used to state that the read format of lookup fields was unstable. It now says that the read format of lookups is an array.

View original
Did this topic help you find an answer to your question?

kuovonne
Forum|alt.badge.img+27

This is quite possible with scripting block.

When you get the records from thisTable, you can get records from only a specific view. Use SelectRecordsAsync on the view instead of the table.

Are the lookup values the ones that will change field type? What is the new field type? You might have to play around a bit to get the lookup values in the format you want. The documentation used to state that the read format of lookup fields was unstable. It now says that the read format of lookups is an array.


Reply