Page 2 of 2

Re: desktop and standalone

Posted: Sat Jul 09, 2022 4:33 pm
by tyarmsteadBUSuSfT
Thank you.
I think the problem is getting the file into the documents/sandbox. Currently I am using this code at startup:

If there is not a file (URL "file:" & specialFolderPath("documents") & "/CarBuildApp" & "/Receipt.txt") then
put empty into URL ("file:" & specialFolderPath("documents") & "/CarBuildApp" & "/Receipt.txt")
end if

Re: desktop and standalone

Posted: Sat Jul 09, 2022 6:44 pm
by jacque
With respect to the mobile build: How are you getting the text file into the mobile sandboxed Documents folder? I wonder if this is the problem you're having?
That could certainly be the problem. I ran into the same thing recently and there is no way currently to access the public device folders. I've submitted a feature request for it.

One workaround for now is to upload the file to a server and then have the app download it. Or you could copy the text to the clipboard with a text editor and have the app get it from there. Neither method is suitable for a professional app.

Re: desktop and standalone

Posted: Sat Jul 09, 2022 9:15 pm
by SparkOut
tyarmsteadBUSuSfT wrote: Sat Jul 09, 2022 4:33 pm If there is not a file (URL "file:" & specialFolderPath("documents") & "/CarBuildApp" & "/Receipt.txt") then
Looks wrong, I don't think you need to mix the file and URL syntax

Code: Select all

If there is not a file (specialFolderPath("documents") & "/CarBuildApp" &  "/Receipt.txt") then
might be better, but I'm not sure what you're trying to do. If there isn't a file, then create an empty file? Do you populate and save this later?

Re: desktop and standalone

Posted: Sun Jul 10, 2022 12:24 pm
by stam
SparkOut wrote: Sat Jul 09, 2022 9:15 pm Looks wrong, I don't think you need to mix the file and URL syntax
1: The OP is looking to import a text file - the URL syntax is correct as per the documentation:
dictonary - file.jpg
2: The issue is how to access a text file on mobile, as actually this is the sticking point. AFAIK, LC does not offer an API for general non-sandboxed files folder (which does exist at least for iOS, i presume for Android as well). The other option is to get this from a web service - either an API or storage like Dropbox (or copy it to clipboard).

The real question is how does the OP plan to derive the text file? is it something generated inside the app? If it's user-entered with the app, you can just use the sandboxed Documents folder of course, but otherwise need another way to get the text data in. It really depends on the OP's planned workflow...

Re: desktop and standalone

Posted: Sun Jul 10, 2022 12:29 pm
by Klaus
Hi stam,
stam wrote: Sun Jul 10, 2022 12:24 pm
SparkOut wrote: Sat Jul 09, 2022 9:15 pm Looks wrong, I don't think you need to mix the file and URL syntax
1: The OP is looking to import a text file - the URL syntax is correct as per the documentation:dictonary - file.jpg
...
true, but Sparkout meant the syntax for checking the existence of that file:
SparkOut wrote: Sat Jul 09, 2022 9:15 pm
tyarmsteadBUSuSfT wrote: Sat Jul 09, 2022 4:33 pm If there is not a file (URL "file:" & specialFolderPath("documents") & "/CarBuildApp" & "/Receipt.txt") then
Looks wrong, I don't think you need to mix the file and URL syntax

Code: Select all

If there is not a file (specialFolderPath("documents") & "/CarBuildApp" &  "/Receipt.txt") then...
Best

Klaus

Re: desktop and standalone

Posted: Sun Jul 10, 2022 12:40 pm
by stam
I stand corrected, Sorry Sparkout!!!
I didn’t see the OPs further post, just the original code.

On that point (now that I actually read the post sparkout was responding to ;) ), not sure why the OP would need to create an empty file if one doesn’t exist? I can’t imagine that serves a purpose?
Check the file when populating the data grid, if it snempty then data grid will be empty, if not populate it. Can’t see a reason for creating an empty file?
All the OP would need to do when reading data in the data grid is start with

Code: Select all

If there is not a file (<fikepath, not URL>) the 
   Set the dgData of group “<data grid name>” to empty
   Exit to top
End if
Or even better, just use the existing code as is with a different modification: check the result after trying to read the file and if this shows an error then pout empty into dgData - should catch any file IO error…

In trying to help the OP, this point still stands however:
stam wrote: Sun Jul 10, 2022 12:24 pm The real question is how does the OP plan to derive the text file? is it something generated inside the app? If it's user-entered with the app, you can just use the sandboxed Documents folder of course, but otherwise need another way to get the text data in. It really depends on the OP's planned workflow...

Re: desktop and standalone

Posted: Sun Jul 10, 2022 6:25 pm
by tyarmsteadBUSuSfT
Thank all for the input. Yes my issue s when the user saves data, I need it to save to the file then when the user goes to the data grid card they are able to see the list of their saved data. The reason I was creating a file ate startup I did, t thing LC would create the file when the user first saved the first entry. I tried to copy the file as part of the standalone settings but I still could not retrieve the data. Should I have copy the files and then used "engine" instead of "documents"
Thank you
Ty

Re: desktop and standalone

Posted: Sun Jul 10, 2022 7:02 pm
by SparkOut
1) don't use specialFolderPath ("engine") - instead, use specialFolderPath ("resources")
2) specialFolderPath ("resources") (or 'engine') is a read only location, so if you need to save updates, you should copy it to specialFolderPath ("documents") on first run. This is where you should check for the existence of the file in "documents" and if not there, then copy from "resources".

Re: desktop and standalone

Posted: Sun Jul 10, 2022 9:33 pm
by tyarmsteadBUSuSfT
Thank you, I'll give it a go.
Thanks all. of you for the help esp. on a weekend.
Ty