Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Database & Dropdown
Page 2 of 2

Re: Database & Dropdown

PostPosted: Tue Mar 04, 2008 9:56 am
by nmc
Orbforms doesnt support block-local declarations, so move those declarations before (or after) the line beginning with "Database".

Re: Database & Dropdown

PostPosted: Tue Mar 04, 2008 1:01 pm
by zyzix
Okay, thanks nmc that one works now, i can compile without any error, however - it seems that the appCreator Database Snippet does not work.
The error Message (on Palm) is Addr: 1088 Func:colorForm.onopen: Database must be opened/created first.
Okay, this how i create the DB:

Code: Select all
if (colorDB.create("farben", "data", app.creator, false))
{
and so on...


Hmm, i don't get this, has anyone an idea how i can fix this? Thank you for your support, -zyzix.

Re: Database & Dropdown

PostPosted: Tue Mar 04, 2008 6:00 pm
by tommyrev
Well, the first two lines stand out to me:

Database colorDB;
if (jobDB.create("farben", "data", app.creator, false))


You have declared a database variable, colorDB. Then, on the very next line you are using a different database variable, jobDB. I do not see where you have declared this second database variable. Either you mistyped the variable name in the second line, and it should have been colorDB, or you need to declare a variable for this second database - e.g.

Database jobDB;

In addition, I see the following line of code later:

int cnt = db.nrecs, i=0;

Where do you declare the variable db? If it is a third database, then I would expect to see a declaration somewhere:

Database db;

Re: Database & Dropdown

PostPosted: Tue Mar 04, 2008 10:23 pm
by samps
Move your declaration of the StringList out of the IF-loop and paste it in just below the place where you declare your database and see what happens.

Samps

Re: Database & Dropdown

PostPosted: Tue Mar 04, 2008 10:25 pm
by tommyrev
Show your whole code again. I suspect that you now have a database variable (e.g., Database db) that you are trying to call some method on (such as db.getrec) without having call either db.open or db.create. Without seeing all you code, who knows.

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 8:48 am
by zyzix
Okey, first thanks to you tommyrev! I've added the lines you give me, indeed - it looks better now but after Building the prc the error on the palm remains. Here's the code:

Code: Select all
handler personalForm.onopen() {
   string pages[2] = { "Einfach", "Erweitert" };
   
   // Datenbank f?ºr die Farben aufbauen
   Database colorDB;
   Database db;
   
   StringList sl;
   string txt;
   DBRecord rec;
   int cnt = db.nrecs, i=0;

   if (colorDB.create("farben", "data", app.creator, false))
   {
      while (i<cnt) {
         if (colorDB.getrec(i, rec, true)) {
            rec.read(&txt, typeof(txt), 1);
            rec.close();
            sl.add(txt);
            ++i;
         //}
      //list.setitemslist(sl);
      }
   else
      alert("colorDB wurde nicht geladen!.");
   colorDB.close();


No other linked codeparts are there. It should just load a second database which loads the colors (red,blue,green etc). The List is "listColorlist" and the popup is "popColors". Thank you, - zyzix

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 9:57 am
by nmc
* db.nrecs must be colorDB.nrecs
* the assigment has to be after the create/open
* if you create the db, its empty, so you wont get any records out of it; instead, you should try open() first and create() if that fails

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 12:36 pm
by zyzix
nmc wrote:* the assigment has to be after the create/open

Hmm, but as i remember OrbForms does not support block-based declarations ? Thanks for the hint for the db.nrec to colorDB.nrec. So how to declare the int cnt = colorDB.nrecs, i=0; before the create/open *outside* the if/else ? The code is mainly the same as above. Thank you, -zyzix

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 1:03 pm
by nmc
You are really new to programming, arent you? ;-)
Code: Select all
int cnt, i = 0;
...
if (db.create(...)) {
   cnt = db.nrecs;
   while (i<cnt) {
      ...
   }
   db.close();
}
list.setitemslist(s);

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 1:39 pm
by zyzix
Hah! Thank you very nmc and tommyrev, it works now perfectly, exactly how i've imagined :D - yes i'm quite new in the software devlopment area. Again, thank you very much for your patience ;) -zyzix

For others wo have the same problem heres my full db-code:

Code: Select all
   Database colorDB;
   StringList sl;
   string txt;
   DBRecord rec;
   int cnt, i = 0;

   if (colorDB.create("colors", "data", app.creator, false))
   {
      while (i<cnt) {
         if (colorDB.getrec(i, rec, true)) {
            rec.read(&txt, typeof(txt), 1);
            rec.close();
            sl.add(txt);
            ++i;
      }
   else
      alert("Could not load database!");
   colorDB.close();

Re: Database & Dropdown

PostPosted: Wed Mar 05, 2008 1:50 pm
by nmc
This cant work as exprected, because:
1. variable cnt isnt initialized, so your "while (i<cnt)" has random result
2. as I said before, when you create a db it is empty, so you will never be able to read the contents of a record (db.nrec=0, your while() loop will never be executed)

Use open instead of create and create/fill the db elsewhere.

Re: Database & Dropdown

PostPosted: Thu Mar 06, 2008 3:03 pm
by zyzix
Yes i knew that the DB was empty so i replaced it with the open part and send some sample db from the computer to the Palm (Z22). One question tough: What does the StringList sl; exactly ?

Re: Database & Dropdown

PostPosted: Thu Mar 13, 2008 10:01 am
by zyzix
Hmm, i've got the last big question: I am working on the Survey-Example as a basic for my program (Which stores Objects with their colors). Thank to the guys who helped me i've could setup a drop-down list with a second database connection which stores the colors - i've take that snipped and also used it for a third database which is also available in the drop-down menue. Now, i have other GUI Components like Textboxes and Buttons. When i'm entering some Values in the PALM (in my case: name(textbox), product(db-drop-down), color(db-drop-down) and the size (buttons). After that, i'm clicking on "Save" and the screen clears and the Values are saved into the "productDB". But the values of the two drop-down menues are not saved. I'm guessing (based on the Survey-Documentation) that i have to add the code into the RecordMgr.oc which includes all save functions. The basic save-routine looks like:
Code: Select all
void savePersonalData() {
  // save the data from the form into the current record
  entry.per.name = fldPersonalName.text;
  entry.per.age = fldPersonalAge.text;
  if (pushMale.checked) {
    entry.per.sex = 0;
  } else {
    entry.per.sex = 1;
  }
  entry.per.status = listPersonalStatus.selitem;
}


Has anyone here an idea how i could implement the save function for the two drop-down menues ? I really appreciate it.
Thank you very much for your support. -zyzix

Re: Database & Dropdown

PostPosted: Thu Mar 13, 2008 4:16 pm
by zyzix
Nvrmnd. Figured it out myself :)