Thanks for the follow-up Eric, I really appreciate it.
I can’t find any information that could give me a hint of what can I do differently.
I’m defining the schema, and the column format:
import * as coda from "@codahq/packs-sdk";
export const pack = coda.newPack();
const ElementGroupSchema = coda.makeObjectSchema({
type: coda.ValueType.Object,
properties: {
representation: {
description: "Group details represented in a string format.",
type: coda.ValueType.String
},
firstComponent: {
description: "Value of the first component of the group.",
type: coda.ValueType.Number
},
secondComponent: {
description: "Value of the second component of the group.",
type: coda.ValueType.Number
},
},
});
pack.addColumnFormat({
name: "Grouped emelents",
instructions: "Grouped elements in the proper format.",
formulaName: "ToGrouped",
formulaNamespace: "Deprecated",
});
Then, I made a formula to create the group from text entered in a column and generate the object. The formula is working nicely:
pack.addFormula({
resultType: coda.ValueType.String,
name: "ToGrouped",
description: "Formats a grouped set.",
parameters: [
coda.makeParameter({
type: coda.ParameterType.String,
name: "group",
description: "The string with the elemets to form a group.",
}),
],
execute: async function ([group]) {
// ...
},
});
In the table, there are many columns of this type (Grouped elements). There is also a column that processes these columns. For instance, a Result column takes the grouped elements from two columns and generates a new objet to place in itself.
pack.addFormula({
name: "GroupProcess",
description: "Generates a new group from the paraeters of two other groups.",
parameters: [
coda.makeParameter({
name: "firstGroup",
type: //yet to solve
description: "The first group to operate.",
}),
coda.makeParameter({
name: "secondGroup",
type: //yet to solve
description: "The second group to operate.",
}),
],
resultType: coda.ValueType.Object,
schema: ElementGroupSchema,
execute: async function ([firstGroup, secondGroup], context) {
//...
}
});
This is not working, since I haven’t found a way to give the formula access to the right type.
The issue here is that I can’t figure our how to have the formula accept the parameter it needs (a member of the ElementGroupSchema, in this case).
I reviewed the available documentation again hoping to find something that is hiding to my eye. Since packs as new stuff, there is no a similar thread in the community forum also.