← back to Filemaker Mcp
scripts/_gl_recon2.mjs
19 lines
import * as fm from '../src/fm-client.js';
const FULL = '*List Wallpapers - Full View';
// how are existing DW SKUs stored? sample any record to see combo format + supplier values
const s = await fm.findRecords('WALLPAPER', FULL, { 'combo sku': 'CORK98*' }, { limit: 3 }).catch(e=>({records:[],err:e.fmCode}));
console.log('CORK98* (existing PR cork line):', s.records?.length ?? 0, s.err||'');
s.records?.slice(0,3).forEach(r=>console.log(' combo=',r.fieldData['combo sku'],'| Supplier=',r.fieldData['Supplier'],'| Series=',r.fieldData['Series'],'| Name=',r.fieldData['Name of Pattern']));
// try Corkytown by name
const c = await fm.findRecords('WALLPAPER', FULL, { 'Name of Pattern': 'Corkytown*' }, { limit: 3 }).catch(e=>({records:[],err:e.fmCode}));
console.log('Name=Corkytown*:', c.records?.length ?? 0, c.err||'');
c.records?.slice(0,3).forEach(r=>console.log(' combo=',r.fieldData['combo sku'],'| Supplier=',r.fieldData['Supplier'],'| Series=',r.fieldData['Series'],'| Mfr=',r.fieldData['Mfr Pattern']));
// what supplier values look like "phillipe" / "romano"?
for (const q of ['Phillipe*','*Romano*','Phillip*']) {
const r = await fm.findRecords('WALLPAPER', FULL, { 'Supplier': q }, { limit: 2 }).catch(e=>({records:[],err:e.fmCode}));
console.log(`Supplier ${q}:`, r.records?.length??0, r.records?.[0]?.fieldData?.['Supplier']||'');
}
// grab ANY record to confirm field names + combo-dash convention
const any = await fm.findRecords('WALLPAPER', FULL, { 'combo sku': 'DWKK*' }, { limit: 1 }).catch(e=>({records:[]}));
if(any.records?.[0]) console.log('sample DWKK combo:', any.records[0].fieldData['combo sku'], '| ALL keys:', Object.keys(any.records[0].fieldData).slice(0,40).join(','));