Hi,
So I have this tinymesh radio network that's sending data to a tablet using a broadcast. On the tablet, I parse the information and save it in a SQL Express database for the UI to access. The tables it writes to is deemed as "read-only" (not marked as such in any way, but data can be deleted/refreshed by the radio portion at any time, so can't be edited)
The tablet should be able to edit some data.
My thinking was to create "history" tables and read columns that can be edited from there so it is kept consistent on the tablet. The idea is to use triggers on the "Read only" tables to populate the History table when changes come through.
One edit is on a comment field on the header of the information on the table (it then sends back, via a direct message, that this has changed) and is pretty straight-forward:
The mind-bending part (at least in my current state of mental-wellness, lol), is the LineItems table;
LineItems has 3 defining ID's that are autonumber on the master (that is sending the radio packet over the network to the tablet). A requirement is to change the product of that line (which is easy, as above), but what makes it difficult is adding or removing a line item.
LineItem table
ID (auto number)
VID (auto number)
VVMID (auto number)
ProductID (technically an autonumber but is from the Products table and can be edited)
The history table idea in this instance won't work as well (or would it?). Especially for adding or removing line items. I can't generate autonumber's on my end and have to wait for the radio network to respond with an updated broadcast before knowing those.
Currently, to make the UI work, it just add's a negative number in sequence, and works nicely, but now with the integration of the radio network, it complicates things slightly.
If I add (or remove) a line item, I can show it immediately on the UI if reading only from the "History" tables, but when that data comes back for an update on those tables, they'll be seen as new records being inserted considering the ID's, so I'm not sure I'll show 3 line items (for example) instead of 6, that's on the tablet.
I'm wondering if I should ditch the hybrid model entirely and just read from the history tables on the UI to keep it consistent, and when an update on the LineItems come through, to delete/re-populate them each time?
Any thoughts/inputs would be amazing! My head is a bit cloudy currently.
So I have this tinymesh radio network that's sending data to a tablet using a broadcast. On the tablet, I parse the information and save it in a SQL Express database for the UI to access. The tables it writes to is deemed as "read-only" (not marked as such in any way, but data can be deleted/refreshed by the radio portion at any time, so can't be edited)
The tablet should be able to edit some data.
My thinking was to create "history" tables and read columns that can be edited from there so it is kept consistent on the tablet. The idea is to use triggers on the "Read only" tables to populate the History table when changes come through.
One edit is on a comment field on the header of the information on the table (it then sends back, via a direct message, that this has changed) and is pretty straight-forward:
Code:
select Header.ID, Header.Customer, HeaderHistory.Comment
from Header
left join HeaderHistory on header.ID = HeaderHistory.ID
The mind-bending part (at least in my current state of mental-wellness, lol), is the LineItems table;
LineItems has 3 defining ID's that are autonumber on the master (that is sending the radio packet over the network to the tablet). A requirement is to change the product of that line (which is easy, as above), but what makes it difficult is adding or removing a line item.
LineItem table
ID (auto number)
VID (auto number)
VVMID (auto number)
ProductID (technically an autonumber but is from the Products table and can be edited)
The history table idea in this instance won't work as well (or would it?). Especially for adding or removing line items. I can't generate autonumber's on my end and have to wait for the radio network to respond with an updated broadcast before knowing those.
Currently, to make the UI work, it just add's a negative number in sequence, and works nicely, but now with the integration of the radio network, it complicates things slightly.
If I add (or remove) a line item, I can show it immediately on the UI if reading only from the "History" tables, but when that data comes back for an update on those tables, they'll be seen as new records being inserted considering the ID's, so I'm not sure I'll show 3 line items (for example) instead of 6, that's on the tablet.
I'm wondering if I should ditch the hybrid model entirely and just read from the history tables on the UI to keep it consistent, and when an update on the LineItems come through, to delete/re-populate them each time?
Any thoughts/inputs would be amazing! My head is a bit cloudy currently.