this might be due to the fact that global fields are machine-specific. That is, they don't necessarily live on the server.
If you open your hosted db in non-hosted, single-user mode, the globals you set will become the default values for the hosted version.
Inventory is spelled with an "e".
There are no global fields in this file.
Perhaps field "g_earch" is intended to be named "g_search"
And perhaps is intended to be a global.
But it isn't.
How is data entered into that very first field? (g_earch in your original script).
Might it be entered via a different method on the iPad than the computer?
Couple of things...
1) If you include "Set Error Capture [On]", the system will not give you the error you are seeing. Your "If" loop is designed to tell your user, "SKU was not found in database", but without the error capture, that will come after the regular error generated by FileMaker.
2) If zero records are found, your script still has a Refresh Window (flush cached join results). There's no need for a refresh window after the find, and flushing the cached join results is a performance killer.
3) If more than one records are found, your script again has the Refresh Window. Again, you don't need that step and including it will degrade performance.
4) At the beginning, your script looks in SKU to find any records that match $Search. You then set $ID_Item_From_Scan to Swap Invantory::_IDSacNumber_PK. If multiple records are found, your find will cause you to end up on the first record entered, and $ID_Item_From_Scan will be set to the PK of that first record. Are you sure you want that?
5) The Flush Cache to Disk step is not necessary. FileMaker automatically flushes changes from its internal file cache to the computer's hard disk during idle time.
Bruce thank you very much for your help. Its working now. I looked at the script you did and made the changes on mine (good practice). I also fixed my typos. The search field was not set to a global field so i switched that as well. Thank you again.
Thank you for looking at my script. So Question 4, All of my sku's in this table are different. No one sku is the same. If their is then we have to fix it. So i think it should be ok from what you are saying. I do understand tho, what you mean if we had multi able products with the same sku. I will be doing a script for that kind of table soon tho, but if its a line item (on a invoice) i will be wanting it to adjust the qty. field on the line +1. I was unaware that filemaker will flush the cached and refresh. Ill take out those steps. Thank you again for looking at my script and helping me.