Loading failure at launch
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 78
- Joined: Sat Apr 17, 2010 9:21 am
Loading failure at launch
I have the following problem:
When my runtime startsup, everything seems to be ok.
But when I do a specific action on the mysql database, insert and delete, then that action is not performed properly.
When I do it the second time, there is no problem, insert and delete work as programmed.
So I have the feeling that I miss something in the opening script of the stack.
Should there be any insert and delete scripting at the startup?
Thanks,
Rob van der Sloot
When my runtime startsup, everything seems to be ok.
But when I do a specific action on the mysql database, insert and delete, then that action is not performed properly.
When I do it the second time, there is no problem, insert and delete work as programmed.
So I have the feeling that I miss something in the opening script of the stack.
Should there be any insert and delete scripting at the startup?
Thanks,
Rob van der Sloot
Re: Loading failure at launch
Dag Rob,
"on startup" LC did not load any library yet, so your db actions etc. will fail.
You should do this on openstack with a little delay:
Then you can be sure everything will work out as exspected.
Groetjes
Klaus
"on startup" LC did not load any library yet, so your db actions etc. will fail.
You should do this on openstack with a little delay:
Code: Select all
on openstack
## Your stuff here
## ...
send "your_db_stuff_here" to this stack in 1
end openstack
Groetjes
Klaus
-
- Livecode Opensource Backer
- Posts: 78
- Joined: Sat Apr 17, 2010 9:21 am
Re: Loading failure at launch
Hi Klaus,
I don't understand fully.
In the "openStack" script there is already a lot of db_stuff, because a lot of data from the database is loaded into the main screen.
But then when I do an action for a new insert, I open a substack with all possible options to choose, which are all loaded from the database.
From this substack data are put into fields and also a number of insert and delete actions are performed.
I don't see what extra library has to be opened.
Its probably some variable missing the first time. But I havent found that yet.
thanks
Rob
I don't understand fully.
In the "openStack" script there is already a lot of db_stuff, because a lot of data from the database is loaded into the main screen.
But then when I do an action for a new insert, I open a substack with all possible options to choose, which are all loaded from the database.
From this substack data are put into fields and also a number of insert and delete actions are performed.
I don't see what extra library has to be opened.
Its probably some variable missing the first time. But I havent found that yet.
thanks
Rob
Re: Loading failure at launch
Dag Rob,
sorry, looks like I misunderstood this one:
Please post your script.
Best
Klaus
sorry, looks like I misunderstood this one:
that you are doing this "on startup", which is obviously not the case.When my runtime startsup...
Please post your script.
Best
Klaus
-
- Livecode Opensource Backer
- Posts: 78
- Joined: Sat Apr 17, 2010 9:21 am
Re: Loading failure at launch
OK, here are the 2 scripts where the problem is situated.
Its about setting up meals based on certain input.
By the creation of the "treatment plan" all meals are preset to "Full" (that means breakfast, lunch & diner). These are invoicelines created for every day of the duration of the treatment plan.
But when a "special type of treatment" is prescribed, then also specific meal types are included. Those mealtypes are connected to the "special type of treatment" . That means that the "Full" type needs to be deleted, and the others are inserted. So the "full" invoiceline is deleted, and there are a breakfast, lunch and diner invoiceline created.
This works usually fine, only when its the first time, after the treatment plan is opened, this delete of the "full" invoiceline does not work. The script "E01_procesMeals" processes this and works ok, only the last one "D04_DeleteInvoiceLineProductType", does not delete the "Full" invoiceline in the "doc07_invoicelinesmav" table when its the first time. If I do it again a second time, after controlling the invoicelines, it works. But that means that the user has to check the invoicelines and remove or create again. This is not very user friendly.
I hope you can follow this.
All the best,
Rob
# Updates the Breakfast, Lunch and Diner fields in the table: pt13_products
# Creates Invoicelines in the MAV invoicelines table
on E01_procesMeals
# proces Prep
E02_procesPrepBreakfast
# proces Lunch
E03_procesLunch
# proces Diner
E04_procesDiner
# Delete Full Invoice Record
put "Full" into tProductType
D04_DeleteInvoiceLinesProductType
end E01_procesMeals
----------------------------------
# Delete Invoicelines based on bgID, RowNr,ProductType & TreatColumn
on D04_DeleteInvoiceLinesProductType
put "DELETE FROM doc07_invoicelinesmav WHERE bgID=" & bgID & \
" and DayNr = " & gRowNr & " and ProductType = " & quote & \
tProductType & quote & " and TreatColumn = " & tTreatColumn into tSQL
put "mamsdocument" into tDBName
ConnectToDatabase
revExecuteSQL gConID, tSQL
revCloseDatabase gConID
put the result into tResult
handleRevDBerror
end D04_DeleteInvoiceLinesProductType[/indent]
Its about setting up meals based on certain input.
By the creation of the "treatment plan" all meals are preset to "Full" (that means breakfast, lunch & diner). These are invoicelines created for every day of the duration of the treatment plan.
But when a "special type of treatment" is prescribed, then also specific meal types are included. Those mealtypes are connected to the "special type of treatment" . That means that the "Full" type needs to be deleted, and the others are inserted. So the "full" invoiceline is deleted, and there are a breakfast, lunch and diner invoiceline created.
This works usually fine, only when its the first time, after the treatment plan is opened, this delete of the "full" invoiceline does not work. The script "E01_procesMeals" processes this and works ok, only the last one "D04_DeleteInvoiceLineProductType", does not delete the "Full" invoiceline in the "doc07_invoicelinesmav" table when its the first time. If I do it again a second time, after controlling the invoicelines, it works. But that means that the user has to check the invoicelines and remove or create again. This is not very user friendly.
I hope you can follow this.
All the best,
Rob
# Updates the Breakfast, Lunch and Diner fields in the table: pt13_products
# Creates Invoicelines in the MAV invoicelines table
on E01_procesMeals
# proces Prep
E02_procesPrepBreakfast
# proces Lunch
E03_procesLunch
# proces Diner
E04_procesDiner
# Delete Full Invoice Record
put "Full" into tProductType
D04_DeleteInvoiceLinesProductType
end E01_procesMeals
----------------------------------
# Delete Invoicelines based on bgID, RowNr,ProductType & TreatColumn
on D04_DeleteInvoiceLinesProductType
put "DELETE FROM doc07_invoicelinesmav WHERE bgID=" & bgID & \
" and DayNr = " & gRowNr & " and ProductType = " & quote & \
tProductType & quote & " and TreatColumn = " & tTreatColumn into tSQL
put "mamsdocument" into tDBName
ConnectToDatabase
revExecuteSQL gConID, tSQL
revCloseDatabase gConID
put the result into tResult
handleRevDBerror
end D04_DeleteInvoiceLinesProductType[/indent]
Re: Loading failure at launch
Is tProductType (and the other variables) local or global?
Since you are not passing it to the handler "D04_DeleteInvoiceLinesProductType".
And it is always a good idea to:
So you can check the SQL string.
Since you are not passing it to the handler "D04_DeleteInvoiceLinesProductType".
And it is always a good idea to:
Code: Select all
...
put .... into tSQL
ANSWER tSQL
...
-
- Livecode Opensource Backer
- Posts: 78
- Joined: Sat Apr 17, 2010 9:21 am
Re: Loading failure at launch
I am practically only using globals.
What use is it to declare locals anyway, since they always work without declaration?
I have checked all my tSQL strings. If there would be a variable missing, it would'nt work at all.
I have already sorted out that maybe a variable is not yet declared the first time, but I can't find any.
Thanks
Rob
What use is it to declare locals anyway, since they always work without declaration?
I have checked all my tSQL strings. If there would be a variable missing, it would'nt work at all.
I have already sorted out that maybe a variable is not yet declared the first time, but I can't find any.
Thanks
Rob
Re: Loading failure at launch
Erm, I think you are confusing 'local' variables with 'temporary' variables, i.e. -Rob van der Sloot wrote: ↑Sat Jan 18, 2020 5:51 pmWhat use is it to declare locals anyway, since they always work without declaration?
Code: Select all
#declared local variable at top of script is available to all handlers below it....
local thisVar
on mouseDown
# this temporary variable is different than the one in mouseUp...
put 1 into tmpField
# the script local variable thisVar will hold "1" to be used anywhere else in this script,
# such as the next handler that adds to it...
put 1 into thisVar
end mouseDown
on mouseUp
# temporary variable declared without 'local' is only available during the scope of this handler...
put field 1 into tmpField
# declared local variable available wherever it is called from if created within handler...
put "Foo" && "Bar" into local fooBar
put fooBar after thisVar # will contain "1 Foo Bar"
-- other stuff
end mouseUp