Should we be in a hurry too?
The values ( TextBoxes ) could be empty. That is the problem. In the SET command there can't be any empty values out there. So, how can I solve this problem?
If the textboxes are empty, what is your intention for the Update?
- don't update the columns for empty textboxes, leaving them at prior value, or
- set the columns to empty string or zero?
For case 2, we need to see the effect of the blank value in the error message.
Did a numeric column require a 0 but got an empty string?
Did a text column require ' ' wrappers around its value?
As a work around, you can strip off those " characters usinga text replace block, each time you are about to update thestudent absences in the table.
That's a good reason not to store lists in SQL table columns,
but instead to get the data model right and replace lists with
rows in a separate table.
It's not obvious to me why you would get an extra blank for the second "but not for the first " of the pair.
Use the trim() text block.
If the textboxes are empty, what is your intention for the Update?
don't update the columns for empty textboxes, leaving them at prior value, or
set the columns to empty string or zero?
For case 2, we need to see the effect of the blank value in the error message.
Did a text column require ' ' wrappers around its value?
I think in the case when a textbox is empty and do an UPDATE, I want to set the text columns to empty string.How can I solve that problem, when run the UPDATE command?
You are using the .SET block extension to the SQLLite extension.What is the output of that block for an empty string?I would expect the literal representation of an empty stringin a SQL statement to be '' (two apostrophes back to back).
I'll mark this thread closed, then.
Glad you got it working
(until you try to calculate student absence statistics,
when you will be back and sorry you did not
keep them in a separate table.)
What happened to the designs and diagrams you made about a year ago? It should have the proper 3rd normal form if I remember well.
That data model doesn't look quite right.
The foreign key from the Absences table should be the
ID of the class session from the Orak table, with a matching numeric type
matching the numeric type of the primary key of the Orak table.
Is this what you advised?
If I am right, then this is a one to one relationship?
I want one to many relationship; on one class session there could be zero, or more missing students. Right?
2. How can I set the WHERE clause? This is the Foreign key and I want to refer to the Hours ( Orak ) table's id. Moreover, in my app I SELECT a record from the Hours ( Orak ) table which has it's id. How can I use this id in these Blocks for this purpose, that is, for set the WHERE clause?
This way I get the names of missing students into textbox, but like this:
Name1
Name2
This way I get the names of missing students into textbox, but like this:
Name1
Name2
However, I would like to get those names into textbox like this:
Name1, Name2
How can I achive this goal?
I did it!
I used the 'replace all text' Text block like this:
segment: '\n' for the new line ( without '' )
replacement: ', ' note the SPACE after comma.
convert the result into a list using the split block, just split at \n (new line), then use select list item blocks to get the values
set textbox1.text to select list item listResult
1
set textbox2.text to select list item listResult
2
Your solution Pal is fine. Simple and it works. :)
Actually, you want to do 3 INSERT statements. A very good idea would be to try this out first on an SQLite database using the Firefox plugin. It is much easier to debug.
If you have the SQL right, then you can try to implement this using the SQLite extension.
Cheers, Ghica
A missing single quote?
What are you thinking?
Actually, you want to do 3 INSERT statements. A very good idea would be to try this out first on an SQLite database using the Firefox plugin. It is much easier to debug.
If you have the SQL right, then you can try to implement this using the SQLite extension.
What exactly should the INSERT statement look like that you need?
By the way, if Hianyzok.Text contains something like "student name1, student name2, student name3", then you could make a list out of it like this:
You should get your az primary key value from the Azok (Hours) table ina separate step before you start the loop though the absent student names.
What makes me disturb is that the list is not separated by commas or anything else.
So what is the right way to get the proper list?
Should I get the az Primary key value from Orak (Hours) table within the 'for each item in list + get "HianyzoTanulok" / do' block?
According to your blocks and the Do It results,you had two names, name1 \n\n name2.
So if that is how you want your users to enter names,
do a split at \n on the .Text value,
then ignore empty text items in the resulting list.
I want my users to enter names like this:Gubi Dávid, Bozsonyi Kristófinto textbox:
name1, name2, name3
So in this case what is advisable to do?
This would be a good place to give thought to populatinga List Picker from the DISTINCT student names in a (not yet existing)table of student enrollmentsthat would cover this class.Wouldn't it be friendlier to your users to let them select names one at a timefrom their class roster, instead of having to type them?
You are working with 2 database environments, the cli on your desktop and the AI2 emulator,and they got out of sync?
P.S. Here is a sample doc showing how to
pick multiple items from a list into another list
Can't find the math block you're looking for in the built-in blocks?
Some math blocks are dropdowns which means that they can be converted into different blocks. Here's a list of what is included in each dropdown:
=, ≠, >, ≥, <, ≤
I found it, but it is look like different then in your document, right?
Now I'm thinking of giving for the listpickers the names of missing students from the database.
If I fill the 'Missing' listpicker with names of Missing Students from database, then how to fill the 'Enrollment' listpicker with those names which are in the Enrollment - except with names which are already in the 'Missing' listpicker?