Page 1 of 2

Populating tables

PostPosted: Thu Aug 16, 2012 3:29 am
by Totte
Hi

I have HTC HD2 Mobile 6.5

I need some help with populating tables.

This is how it looks:

Tables: Sites, Surveys, CheckList, ChkList

Sites is related to Surveys
Surveys is related to CheckList

ChkList is "template" table containing questions for the inspector to give answer to.

Table CheckList is from start empty.
I have managed to populate it with popup from table ChkList, one record at the time.
This method is not effective.

I would like to transfer all records from ChkList to CheckList and get the relation to Surveys set on every record.

Is this possible ?

// Torsten Andersson

Re: Populating tables

PostPosted: Mon Aug 20, 2012 10:30 pm
by Brian_Houghton
Hi,

Thanks for posting. You can use the DB Popup field in several instances to pull multiple values from the lookup table. To do this, start by making sure you have all of the fields added to the database that will serve as your lookup table. Then add DB Popup fields to your parent database - one for each item you wish to pull. When doing so, make certain that you select the lookup database/table and choose the fields you want to pull from.

The next part is important, as it joins all fields causing the values from multiple fields all at once. Assign each DB Popup field with the same group number, which must be something other than 0.

Hope this helps.

Re: Populating tables

PostPosted: Tue Aug 21, 2012 1:36 am
by Totte
Hi
I think You misunderstood my question.
I already use this teknik You described.
The problem with this is that it pulls one record each time.

I want to pull all records from table c to table b with one operation
and at the same time have the relation set to table a for these.

// Torsten Andersson

Re: Populating tables

PostPosted: Tue Aug 21, 2012 6:08 am
by Brian_Houghton
Should you want to move/copy all of your records from one database to another, the only option is to use the "copy records" option in the menu. Note that in order to do this, the field names and types in both databases have to be the same. Using this method, your relationships will be retained.

Re: Populating tables

PostPosted: Fri Aug 24, 2012 2:40 am
by Totte
OK

I have problem with this method because in the table I copy from
the relation is not set due to the fact that it is a template table
to be used in every new servey the inspector does.

// Torsten Andersson

Re: Populating tables

PostPosted: Sat Aug 25, 2012 9:40 am
by Brian_Houghton
You would want to configure the relationship field prior to copying the records to the template, and you would want to make sure that each of your users have a copy of the related database. I'm assuming the related database is a static file that isn't changing, right? If so, once you have the field in the template configured to point to it, copying the records from one database to the template should work with no problem. The nice thing about relationship fields is that you don't have to go through and manually enter them. The relationship field, when activated, takes the text in the field, goes to the related database, and looks for matches in the specified field. It is in working this way that you can copy in knowing that your relationships will still work so long as the user has a copy of the related table.

Re: Populating tables

PostPosted: Wed Aug 29, 2012 12:33 am
by Totte
Hi Brian

The template table can not have any relation prior to copy.

Is there any method to set the relation to parent record for all copied records after or under copy procedure
e.g. get the related field value in parent record to the related field in child table for all records copied to child table ?

I hope You understand.

//Torsten Andersson

Re: Populating tables

PostPosted: Thu Aug 30, 2012 5:49 am
by Brian_Houghton
You can safely add the the relationship field after the records are copied. Since the relationship field is based on a sophisticated search, this will work. Please try it out with a sample database to see how it should meet your needs.

Re: Populating tables

PostPosted: Thu Aug 30, 2012 6:23 am
by dhaupert
I'm not sure I understand what is being asked- but the field types are checked for the copy, so you just have to have the fields match in source and destination- they do not have to point to the same related table, just be the same types.

Re: Populating tables

PostPosted: Wed Sep 05, 2012 6:45 am
by Totte
Hi again

Sorry for the poor explanation of my problem.
I will now take it from scratch.

I have three tables.

Suveys
Checklist
tmpl_checklist

Checklist is linked to Surveys

Surveys contains my surveys.
Checklist contains the questions that shall be answered for each servey.
tmpl_checklist contains a set of questions and is not linked to any table.

Now, first I create a new record in Serveys.

From the Serveys form I go to Checklist form via a button.

Checklist is at this moment showing no records for my new servey.
I create a new record in Checklist and populate the fields via a DBpopup from first record in tmpl_checklist.
I create a new record in Checklist and populate the fields via a DBpopup from second record in tmpl_checklist and so on.

This works but due to the number of records in tmpl_checklist this is not a conveniently method.

To save time, for every servey I work with, I would like to copy all the records from tmpl_checklist to Checklist with one single command.

As far as I know the linked field will only be set when you create new records, not when you copy.

Is there a workaround.

//Torsten Andersson