ned@kelly.org.au
Joined: 08 Apr 2004
Posts: 22
Location: Mosquito Flat, Australia
Posted: 2004-06-30 01:41
Back to top
Reply with quote
|
Hi again
I have 3 tables
1. Software
- SID
- Sofware_Name
2. Assets
- AID
- Asset_Name (Asset_Name is unique)
- Asset_User
3. Software_On_PCs
- SPCID
- SPC_Asset_Name (comes from Assets:Asset_Name)
- SPC_Software_Name (comes from Software:Software_Name)
And I want in the list view of the Software_On_PCs table the Asset_User(from Assets) to appear as a virtual row, but I cant figure it out
I have tried
| Code: |
$opts['fdd']['SPC_User'] = array(
'name' => 'SPC User',
'select' => 'T',
'maxlen' => 30,
'sort' => true,
'values' => array(
'table' => 'Assets',
'column' => 'Asset_User',
),
'join' => 'Software_on_PCs.SPC_User = Assets.Asset_User'
);
|
but just cant get it to work, im sure it straight forward
Any help would be greatly appreciated
Cheers
Ned
|
michal
Joined: 17 Jun 2003
Posts: 537
Location: Slovakia
Posted: 2004-06-30 10:50
Back to top
Reply with quote
|
since the join is already made in another column, it is enough just to call that coulumn. something like
| Code: |
'sql' => 'Join4.Asset_user'
|
(no 'values', no 'join')
note that 'Join4' can be something different and that number can change without warning (if you change the configuration file). mysql error message will show you which number to use (the one with asset_name next to it)
|
ned@kelly.org.au
Joined: 08 Apr 2004
Posts: 22
Location: Mosquito Flat, Australia
Posted: 2004-07-01 03:36
Back to top
Reply with quote
|
Hi Michal
Thanks for the reply
below is my code
| Code: |
$opts['fdd']['SPC_ID'] = array(
'name' => 'SPC ID',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 11,
'default' => '0',
'sort' => true
);
$opts['fdd']['SPC_Asset_Name'] = array(
'name' => 'SPC Asset Name',
'select' => 'D',
'maxlen' => 20,
'required' => true,
'sort' => true,
'values' => array(
'table' => 'Assets',
'column' => 'Asset_Name',
)
);
$opts['fdd']['SPC_Software_Name'] = array(
'name' => 'SPC Software Name',
'select' => 'D',
'maxlen' => 30,
'sort' => true,
'values' => array(
'table' => 'Software',
'column' => 'Software_Name',
)
);
$opts['fdd']['SPC_User3'] = array(
'name' => 'SPC User',
'select' => 'T',
'maxlen' => 30,
'sort' => true,
'sql' => 'Join2.Asset_User'
);
|
and it gets the following MySQL error
(i have tried changing Join2 to Join0,1,3,4,5,6 but still get the same error number. as well as PMEjoinX and PMEtabeleX)
| Code: |
MySQL error 1109
Unknown table 'Join2' in field list
----------------------------
phpMyEdit error: invalid SQL query
----------------------------
SELECT PMEtable0.SPC_ID AS qf0,PMEtable0.SPC_Asset_Name AS qf1,PMEtable0.SPC_Asset_Name AS qf1_idx,PMEtable0.SPC_Software_Name AS qf2,PMEtable0.SPC_Software_Name AS qf2_idx,Join3.Asset_User AS qf3 FROM Software_on_PCs AS PMEtable0 ORDER BY PMEtable0.SPC_ID,PMEtable0.SPC_Asset_Name LIMIT 0,1515.826 miliseconds
|
Is there something missing from my code??
Thanks again Michal for all your help
Cheers
Ned
|
michal
Joined: 17 Jun 2003
Posts: 537
Location: Slovakia
Posted: 2004-07-01 15:41
Back to top
Reply with quote
|
as i see there is no join clase in that sql, so pme is doing some optimalization for unneccessary code. i didn't know it's that good :)
the easiest solution i see is 'values' for spc_user (with appropriate description field) and standard output on spc_software_name (no join is neccessary). (at least for the view part)
you can leave current state in AC mode, if that fits you better.
|
ned@kelly.org.au
Joined: 08 Apr 2004
Posts: 22
Location: Mosquito Flat, Australia
Posted: 2004-07-02 04:39
Back to top
Reply with quote
|
Thanks Michal
I got my reports working the way i wanted,
i had to mess around alot and the code looks like garbage, but hey it worked; thanks
| Code: |
$opts['fdd']['SPC_ID'] = array(
'name' => 'SPC ID',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 11,
'default' => '0',
'sort' => true
);
$opts['fdd']['SPC_Asset_User'] = array(
'name' => 'SPC Asset Name',
'select' => 'D',
'maxlen' => 20,
'required' => true,
'sql' => 'Asset_Name',
'sort' => true,
);
$opts['fdd']['SPC_Software_Name'] = array(
'name' => 'SPC Software Name',
'select' => 'D',
'maxlen' => 30,
'sort' => true,
);
$opts['fdd']['SPC_Asset_Name'] = array(
'name' => 'SPC Asset User',
'select' => 'D',
'maxlen' => 20,
'required' => true,
'sort' => true,
'values' => array(
'table' => 'Assets',
'column' => 'Asset_Name',
'description' => 'Asset_User',
)
);
|
?? Asset_User prints asset_name and asset_name prints asset_user ??
cheers
ned
|
|
Post new topic
Reply to topic
|
|