| Index
» Projects
» phpMyEdit
» Forum
» simple goal that isn't mentioned in the docs |
 |
hlslaughter
Joined: 02 Jul 2003
Posts: 12
Location: San Diego, CA
Posted: 2004-05-12 22:17
Back to top
Reply with quote
|
this is simple enough, but i don't believe it's mentioned in the docs.
i have two fields in one of my templates:
$opts['fdd']['count_reserve'] = array(
'name' => 'Reserve',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
$opts['fdd']['count_allocated'] = array(
'name' => 'Allocated',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
I simply want to have a third field that is the sum of these two fields. the only guess i could come up with was something like this:
$opts['fdd']['count_total'] = array(
'sql' => (count_allocated + count_reserve),
'name' => 'Allocated',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);
but 'count_total' is not actually in the DB table, so this fails.
is there some way i can add up the first two fields and create a third virtual field?
tks
harry
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2004-05-13 13:35
Back to top
Reply with quote
|
In the CVS version of PME you can set a field as being a virtual field so it doesn't need to be in the database. Have a look at the documentation in the CVS for the full options.
Then you can do exactly what you need to do.
|
BrentNJ
Joined: 03 Jun 2004
Posts: 12
Posted: 2004-06-13 19:37
Back to top
Reply with quote
|
I can't find the proper section in the CVS docs for virtual fields.
What filename do I need to read?
Thanks!!
|
hlslaughter
Joined: 02 Jul 2003
Posts: 12
Location: San Diego, CA
Posted: 2004-07-17 01:28
Back to top
Reply with quote
|
my biggest problem was that i wasn't using the latest version of PME. i used it before and it seemed to have some new problems that i wasn't ready to deal with. but when i do use the latest version, this gives me the result i was looking for
| Code: |
$opts['fdd']['count_total'] = array(
'name' => 'Total',
'select' => 'T',
'maxlen' => 11,
'sql' => 'field1 + field2',
'sort' => true
);
|
|
|
Post new topic
Reply to topic
|
|
|
|