Hi @Josh_Shupack1 - What is the type of the schema property as you define it in your Pack? If you define it as a String
and change it to an Image column in the doc then I think the Pack will get the ToText()
value of the image, which is the file name. If you define it as ImageAttachment
(or better an array of them) then you’ll get an Image column automatically and your code will get the URLs as expected.
Here’s some rough sample code showing two-way editable image columns:
import * as coda from "@codahq/packs-sdk";
export const pack = coda.newPack();
const ThingSchema = coda.makeObjectSchema({
properties: {
name: { type: coda.ValueType.String },
id: { type: coda.ValueType.String },
image: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.ImageAttachment,
mutable: true,
},
images: {
type: coda.ValueType.Array,
items: {
type: coda.ValueType.String,
codaType: coda.ValueHintType.ImageAttachment,
},
mutable: true,
},
},
displayProperty: "name",
idProperty: "id",
featuredProperties: [
"image", "images"
],
});
pack.addSyncTable({
name: "MyThings",
description: "Table description.",
identityName: "Thing",
schema: ThingSchema,
formula: {
name: "SyncMyThings",
description: "Syncs the data.",
parameters: [],
execute: async function (args, context) {
let rows = [
{
id: "1",
name: "One",
image: "https://images.dog.ceo/breeds/terrier-russell/little1.jpg",
images: ["https://images.dog.ceo/breeds/terrier-russell/little1.jpg"],
},
];
return {
result: rows,
};
},
executeUpdate: async function (args, updates, context) {
let row = updates[0].newValue;
console.log(row);
return {
result: [row],
};
},
},
});