OlgerDiekstra Posted October 7, 2017 Posted October 7, 2017 Hi Folks, I'm having some difficulty getting external data sources to work on FMGO (v16). MyApp consists out of two parts (its basically data separation), one app has the brains and UI, the other only holds the data. In my case the data is just imagery. MyApp is a slide show and a gallery to show customers samples. The iPads that MyApp will run on are used in the field and rarely get back to head office. They will have an internet connection but as images are not often updated, I wanted to separate UI and and data so that if the UI side of it needs an update, it's only an 800KB file, not a 100MB file (400 something images). Images will get updated from time to time, but only some, not usually the whole lot. So I created a main MyApp that has an external data source (using a global variable) and which points to the images file using the fmp protocol. (fmp://~/MyAppData.fmp12). I also tried using file://~/MyAppData.fmp12 but that also didn't work. FMGO complains it can't find the data file. What could I be doing wrong? I have searched but found no info that external data sources are limited on GO or don't work. I use a home screen shortcut using the fmp protocol to launch the MyApp file and that works fine, so the location is correct. Can I not use a dynamic external data source on GO? It works fine on a desktop (Win7) using the documents folder. Thanks!
bcooney Posted October 7, 2017 Posted October 7, 2017 fmp://~/MyAppData.fmp12 ~ is the document folder. I would assume the file is there (since that's all you have on iPad, for now). But, why do you need to have a dynamic path, anyway? The location of the data file isn't going to change. Tony White's PDF
OlgerDiekstra Posted October 8, 2017 Author Posted October 8, 2017 Yep, the file is in the documents folder for sure. The reason I decided to use a dynamic path, is for one because I can, and also to be able to update the file in case I need to. Which goes back to a previous post, about updating an app. I created a MyApp_Launcher.fmp12 which would launch MyApp_v1.0.fmp12. MyApp would then pull its data from MyAppData_v1.0.fmp12. Which means if I wanted to updated either MyApp or MyAppData, I could do that by simply downloading a new version, storing the version number in the launcher and calling a different MyApp file or MyAppData file (the latter's version number would be stored in MyApp). Which means that dynamic external data sources are very handy. However, something is not working as advertised or I'm missing something, or doing something wrong. Thanks for the link to Tony's PDF, found that a while ago too. Very handy.
bcooney Posted October 8, 2017 Posted October 8, 2017 I haven't experimented with $$paths for external data sources yet. My use case would be programmatically switching from dev data source to production. I was thinking to set the $$var by parsing the file name and if it has "DEMO" it would set the $$external_data_source to the demo data file. I wonder if you're encountering some sort of "commit" refresh issue. That is, the $$var isn't established in time. Are you opening up to a layout based on a "starter table" - that is no records, fields and therefore no dependence on a data source? Once there, set the $$var. What happens if you enter add the path manually as the second listing in the external data source dialog. Does it find it?
OlgerDiekstra Posted October 9, 2017 Author Posted October 9, 2017 MyApp uses a single record table (basically a table for application settings) as the first layout which is local. When MyApp starts, it uses the OnFirstWindowOpen trigger to execute a startup script, which sets the global for the data source. So the external source is not touched until everything is in place. The global is set as one of the first actions in the script, but perhaps I should try pausing for a sec and see if that makes a difference. Will have to wait until I have a couple of iPads again as they've just gone out today. Only have a few older minis that won't upgrade to iOS 10 anymore, and as a result only FMGOv15 installs. :-( I haven't tried setting a static data source, but presumably that works. Will have to test too though.
bcooney Posted October 9, 2017 Posted October 9, 2017 7 hours ago, OlgerDiekstra said: MyApp uses a single record table (basically a table for application settings) as the first layout which is local. Yeah, but if that table needs the data source, then FM makes the connection. That's why I use a table that has no fields as a starter. See Low Impact Startup on FileMakerStandards. And you go there when you exit, to avoid: "Avoids accidental External Data Sources from being opened if the last viewed layout was based on an external data source."
OlgerDiekstra Posted October 11, 2017 Author Posted October 11, 2017 I had taken that into account, ensuring the external data source isn't accessed until the global is populated. But I do like that approach of an empty table for opening and closing a database. I should then also be able to close an external data source once I'm on a layout based on an empty table? I've had some trouble closing a data source once opened.
bcooney Posted October 11, 2017 Posted October 11, 2017 It's not you, Olger. I find that once accessed, it's very hard for FM to let go of an external data source. Try calling a script in the EDS that closes itself from the "startup" layout.
Recommended Posts
This topic is 2598 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now