The great feeling of an integrated widget
In the last few days I was able to get a JSON-to-XLSX integration put into a client file. It is super satisfying to do so, to make something happen using the web viewer.
In this case I’m using the web viewer as a calculation engine. It is on a card-window layout where the work is done. It is smooth; it is fast; and it is part of the normal workflow of the script called by a user’s button press.
It is super satisfying because of how easy it is to get this process to happen inside an existing process already. Instead of using the normal Export Records script step, I’m asking the same script to invoke the web viewer. Of course that means an extra script to run and an extra layout to be displayed. It also involves context consideration and scripts that interrupt other scripts. So it isn’t a walk in the park, for sure. But neither, in my opinion, is the Export Records script step.
One of the needs of this process was to create friendly column names for each column. The export in question had 50 or more fields to export, so I was dreading having to write a map for the export.
However I used some Vibe coding inside VS Code and the AI generated me a list map of FileMaker field names to friendly names in the form of an object. For example:
{ “FullName”:”Full Name”, “Contacts::PrimaryPhone” : “Primary Phone”} and so forth.
But then I wanted to make the column-name creation more generic and ‘callable’ inside the FM. I suppose I could have reached out to an MCP or some API to do what VSCode did, but instead I generated a function that could do this job for the types of fields in this client app.
Here’s the function.
// Helper function to generate friendly field names
function generateFriendlyFieldName(fieldName) {
// Remove common prefixes like bost_BO::, bost_AST::, bost_BOI::, etc.
let friendlyName = fieldName.replace(
/^(bost_[A-Za-z]+::|bost_ast_[A-Za-z]+::|boi_bost_[A-Za-z]+::)/,
""
);
// Replace :: with space if it still exists
friendlyName = friendlyName.replace(/::/g, " ");
// Remove common suffixes like __c, __lu, __cn
friendlyName = friendlyName.replace(/__([a-z]+)$/, "");
// Replace underscores with spaces
friendlyName = friendlyName.replace(/_/g, " ");
// Handle special cases for leading underscores (foreign keys, etc.)
friendlyName = friendlyName.replace(/^_kf_/, "").replace(/^__kp_/, "");
// Handle camelCase to add spaces (e.g., camelCase -> Camel Case)
friendlyName = friendlyName.replace(/([a-z])([A-Z])/g, "$1 $2");
// Capitalize first letter of each word
friendlyName = friendlyName.split(" ").map(word =>
word.charAt(0).toUpperCase() + word.slice(1)
).join(" ");
return friendlyName;
}This work got implemented in just a few hours and it works nicely.
I’m not done though. Today’s work on it will be hading the errors. There’s a lot of places where a subscript might fail, or where a subscript receives no data. So I have to go back in and handle that.
Anyway. It’s a good feeling to get something seamlessly implemented into a client’s FileMaker file.
What have you implemented recently that makes you feel good?