standalone for Mac from Windows with Database

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: standalone for Mac from Windows with Database

Post by Klaus » Fri Jun 27, 2014 6:07 pm

Hi fko,
fko wrote:Hi Klaus,

In the beginning of the script i have this line
put "DGPragmaRep" into nameTablePragma...
So i am putting the name of the DataGrid "DGPragmaRep" in one variable...
Do i have to use quotes for the variable? I thought was for the object name...
oh, sorry, no of course NO quotes around variable names!
i was a bit irritated because your variable name is actually longer than the group name with quotes :D
fko wrote: put the dgNumberOfRecords of group nameTablePragma into tCounter
Better delete this line completely!
fko wrote:put the dgNumberOfLines of group nameTablePragma into tCounter

and in boths i have '11' when it is from my developping code and 'empty' from the standalone...:-(
Hm, sorry out of ideas in the moment...
Maybe you can post the stack (ZIP it first)?
fko wrote:Is it posible that the counter is empty if i had values in theDataGridArray[1]["name"] and in theDataPragma[2]["name"]???
No.


Best

Klaus

fko
Posts: 61
Joined: Tue May 20, 2014 2:13 pm

Re: standalone for Mac from Windows with Database

Post by fko » Fri Jun 27, 2014 7:21 pm

Hi Klaus,

Yes, i know that the name of the variable was long...:-)
I used this script in two different substacks...So even if the name was long, i had only to change the first line of the script, where was the name of the DataGrid...
But yes, i agree with you that the name of the variable was long...:-)

ok, i already deleted the line of number of records...:-)

This is all the code i am using in this substack...

local sDatabaseID

On opencard
global myPath
put the effective filename of this stack into myPath

set itemdel to "/"
## remove filename of runtime/stack:
delete item -1 of myPath
put "/BBDD/myDatabase.sqlite" AFTER myPath


set the dgData of group "DGPenC" to empty
set the dgData of group "DGImp" to empty
set the visible of group "DGImp" to false

PutNameColumns

end opencard

on PutNameColumns
global theDataGridArray

databaseConnect

put getDatabaseID() into tDatabaseID
put revQueryDatabase( tDatabaseID, " PRAGMA table_info( Rep )") into theCursor
put "DGPragmaRep" into nameTablePragma

if theCursor is an integer then
ConvertSQLCursorToArray theCursor, theDataGridArray
put the result into theError

if theError is empty then

set the dgData of group nameTablePragma to theDataGridArray
answer "value1 " & theDataGridArray[1]["name"]
end if

## Close the database cursor
revCloseCursor theCursor
end if

put the dgData of group nameTablePragma into theDataPragma
answer "value2 " & theDataPragma[2]["name"]

put the dgNumberOfLines of group nameTablePragma into tCounter
answer "Counter" & the dgNumberOfLines of group nameTablePragma
put theDataPragma[1]["name"] into tColumns
put 2 into i
repeat while i <=tCounter
put cr & theDataPragma["name"] after tColumns
add 1 to i
end repeat

set the dgProp["columns"] of grp "DGPenC" to tColumns
set the dgProp["column labels"] of grp "DGPenC" to tColumns

set the dgProp["columns"] of grp "DGImp" to tColumns
set the dgProp["column labels"] of grp "DGImp" to tColumns

put 1 into i
repeat while i <=tCounter

set the dgColumnAlignment[theDataPragma["name"]] of group "DGPenC" to "left"
add 1 to i
end repeat
answer "end of script"
end PutNameColumns

command ConvertSQLCursorToArray pCursor, @pOutArrayA
local i
local theFields
local theError

## Get the names of all the columns in the database cursor
put revDatabaseColumnNames(pCursor) into theFields
if theFields begins with "revdberr," then
put item 2 to -1 of theFields into theError
end if

if theError is empty then
put 0 into i
## Loop through all rows in cursor
repeat until revQueryIsAtEnd(pCursor)
add 1 to i

## Move all fields in row into next dimension of the array
repeat for each item theField in theFields
put revDatabaseColumnNamed(pCursor, theField) into pOutArrayA[ theField ]
end repeat

revMoveToNextRecord pCursor
end repeat
end if

return theError
end ConvertSQLCursorToArray

command databaseConnect

local tDatabasePath, tDatabaseID
global myPath

put myPath into tDatabasePath
put revOpenDatabase ("sqlite",tDatabasePath,,,,) into tDatabaseID

setDatabaseID tDatabaseID

end databaseConnect

command setDatabaseID pDatabaseID
put pDatabaseID into sDatabaseID
end setDatabaseID

function getDatabaseID
return sDatabaseID
end getDatabaseID

I don't know how to attach you all what i have in this substack ( so the DataGrids) without to create one new application and do it from zero with only this substack...:-(
Anyway it should work if you create one DataGrid with the names of DataGrids i have and then...

regards,
fko

fko
Posts: 61
Joined: Tue May 20, 2014 2:13 pm

Re: standalone for Mac from Windows with Database

Post by fko » Sat Jun 28, 2014 9:19 am

Hi,

I don't know why in the standalone versión is not working with this two options:

1) put the dgNumberOfRecords of group nameTablePragma into tCounter
2) put the dgNumberOfLines of group nameTablePragma into tCounter

Finally i could resolve it (even if it is not a good solution) like this:

put 1 into tCounter
repeat for each key "name" in theDataPragma
add 1 to tCounter
end repeat
subtract 1 from tCounter


But now i have more problems in my standalone versión...And i think they are coming all from the same place...The DataGrid...

In another part of my code i need to know where the user press in one DataGrid to can have the row ( sometimes to delete and others to update)
and i have this line that it is not working
" put the dgHilitedLines of group dgActive into selectedLine ".... Where dgActive is the name of the DataGrid is shown in this momento (i have one function telling me which DataGrid is shown to can know in which one i have to work)

So, the "dgHilitedLines" is not working in the standalone...

It seems that the "dg..." are not working in the standalone: no "dgNumberOfRecords", no "dgNumberOfLines" and no "dgHilitedLines"...
The other two i could resolve them, with the Repeat instruction above...
But for the "dgHilitedLines" i don't know how to do it...

What should i do???

And i have the 'EXE' in the same place as where i am developping and i can't UPDATE the database...The "Select" or "Select Count(*)" are working...but not the "Insert"...
Is it one question of permisión or from the standalone? I am wodering as i am working in the same folder ( and i am the admin so i should have the permisions)...

regards,
fko

fko
Posts: 61
Joined: Tue May 20, 2014 2:13 pm

Re: standalone for Mac from Windows with Database

Post by fko » Sat Jun 28, 2014 11:15 am

Hi,

It is me again...

I was reading once again in the forum looking for one solution and i saw this post

"Datagrid does not work in standalone"
Postby Simon Knight » Thu May 08, 2014 8:18 pm


And there he was speaking about Splash Stack...

And then i looked in the lessons and i saw this one : what do i need to do to deploy a standalone with a data grid?

http://lessons.runrev.com/m/datagrid/l/ ... -data-grid

It is also speaking about Splash Stack...

But i don't know what it is and how to use it

I think this is the solution for all my problems with the standalone and "dg...", but i don't know what i have to do...:-(

regards,
fko

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: standalone for Mac from Windows with Database

Post by Klaus » Sun Jun 29, 2014 3:42 pm

HI fko,

does your MAINSTACK, the one you create a standalone from, contain a DATAGRID?
If yes, then the standalone builder will add the datagrid library automatically!

If NOT, do this:
Add an new and empty datagrid to cd 1 of your mainstack and just HIDE it.
We will not use it and not show it, but htis way the standalone builder will
also add the datagrid library automatically! :D


Best

Klaus

fko
Posts: 61
Joined: Tue May 20, 2014 2:13 pm

Re: standalone for Mac from Windows with Database

Post by fko » Wed Jul 02, 2014 9:49 am

Hi Klaus,

Thanks for your answer...And sorry for my late answer...:-(
I was disconnected these last days...

In fact i saw the solution you are giving me, in another post ( i think was 'Multiple DataGrids' ) to someone who had the same problem as me...
And i made what you told to him and it is working fine in MacOs and Windows...

Thanks one more time...:-)

regards,
fko

Post Reply

Return to “Mac OS”