Hey buddy! I got it (following your lead of course:) )
Two of the tables (redacted, sorry) are for adding new items in the app, not really part of this Patch so I left them out.
For the other three tables, you were right @wyotim, it was all about the Patch order and grabbing the PK's after each Patch and slapping them into the FK of the following table. I used the Last() function for this.
Example:
//Patch values into dateTable
Patch('[dbo].[dateTable]',
Defaults('[dbo].[dateTable]'),
{
siteId: varSiteID,
readingDate: Now()
}
);
//Patch values into readingTable
Patch('[dbo].[readingTable]',
Defaults(
'[dbo].[readingTable]'),
{
dateId: Last('[dbo].[dateTable]').dateId, <--BINGO
unitNum: 1,
xzyName: 1,
zyxNum: 1,
xkdFactor: 1,
supplyXya: 1,
supplyUio: 1,
sortNum: 1,
currentUys: 1,
avgJJk: 1,
prevLLk: 1,
readingNotes: "This is awesome"
}
);
//Patch values into the imageTable
ForAll(
colImageGallery,
Patch(
'[dbo].[imageTable]',
Defaults('[dbo].[imageTable]'),
{
readingId: Last('[dbo].[readingTable]').readingId, <--BINGO
photo: image,
photoNotes: " "
}
)
);Woohoo! That one was not simple to find info on.