Gossamer Forum
Home : Products : DBMan : Customization :

relational dbman jpdeni manual

Quote Reply
relational dbman jpdeni manual
Hi there,

some days before, JPDeni wrote, she would like to read any experience with her relational dbman manual,before she would provide it again .

Here are my test-results:

It works great in it's special way !

After correcting some syntax (typing) errors, the code works in both directions.

I created a 'User.db' and a 'item.db'

they are linked by the UserId-field, which is the keyfield in the user-db.
Okay, getting inforamtion from user-db in displayed records of the item db is not a problem, it's working fine.

Getting a list of the actual items of the user in the displayed user record is working fine -if I'm searching for only one user.

And here is the problem:
Searching for more than one user displays after each record the whole list of items:
example:
user 1,Street, state, city
List of items:
item user1
item user2
item user3

User 2,street, state, city
List of items:
item user1
item user2
etc...

If anybody is interested to answer, here are my questions:

How can i get the items for each user in alist after the user information?

I understood, this part of code will work with every record, because it is placed in html_record, which is called by the db.cgi for every user record.

I tried to put the code in the sub view_records in db.cgi but it didn't work. the debugging reported missing formfields, i understood that the code must be in between a html "form" tag.
Maybe the problem is solved if thecode is placed somewhere else, but after doing some trial and error i give up now....

the code for getting records from the item-db is placed in html.pl: 'html_record_long'

&switch_to_item;
$rec{'USERID'} = $in{'USERID'};
$in{'mh'} = 100;

my ($status2,@hits2) = &query("view");
# this part displays the item records in as #a list
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);

print "<table>";

for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);

print qq|
<tr><td>
<a href="$db_script_url?db=item&uid=$db_uid&ID=$rec2{'ID'}&view_records=1">$rec2{'ID'} $rec2{'ITEM'}</a><BR>
</td></tr>|;
print "</table>";

}
}
&switch_to_user;
Another question:
Is there a way ti build a search which is searching in both dbs for the searchterm and displaying the results in one result-table(page)??


thank you for your helping, maybe Elliot knows an answer or JPDeni comes back soon and knows any answers ?

Thanks again

bek
Quote Reply
Re: relational dbman jpdeni manual In reply to
I can answer your later question. (Sorry, but Carol will have to address your earlier concerns since I have yet to play with the relational mod.)

To allow users to search specific databases, you add radio buttons in the search form (sub html_view_search.

Code:
<input type="radio" name="db" value="DB1">
<input type="radio" name="db" value="DB2">

Change DB1 to the name of your first database and DB2 to your second database. This may solve your first problem by choosing a database first and then inserting fields from the second database in the search results.

I think that your earlier problems are due to the fact that you are searching one database by default rather than choosing the database in the search form.

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: relational dbman jpdeni manual In reply to
I don't think this is possible - because in displayiong any list userID will need to be * - and to call the data from Item db you will need a specific UserID.

I've been playing around with this myself and have had the same problems - won't list them all now.

The first one I ran into was clicking on 'list all' from User db when there is only one 'User' and has 'Items' posted (im listing Items names on the User html_record).

I get "fatal error: Undefined sort subroutine "main::_ascend" called at.."

This happens because with only one user record it calls html_record_long directly with userID = *

now the solution would be to call "short display" even if there was only one record.. i tried this and it didn't seem to work.

does this make sense? any suggestions?

[other problems will follow]

-frank

[This message has been edited by FLThiak (edited October 28, 1999).]
Quote Reply
Re: relational dbman jpdeni manual In reply to
I didn't gaurantee that the solution would be designated radio buttons. All I gave you was codes to answer your second inquiry.

Again, Carol may have to help you with this since she wrote the Mod.

Wink

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: relational dbman jpdeni manual In reply to
Hi Eliot & FLThiak,

thanks for yours answering, I'm still playing around. Didn't thought about using short/long mod, but i will give a try, maybe it's a solution for my afforts but with a step between (short display).

Eliot:

The search in two databases you explained will work, but i hoped to find a way the user will not see (and feel...) that she/he will search in different databases.

Maybe it's a solution to install a new sub in html.pl, which must be defined in sub main in db.cgi????
working in this kind of process:

search for the input (keyword) in db1

if no searchterm found
search in db2



FLThiak:

I'm still working (trying ;-)) with the relational mod,
yesterday suddenly nothing worked anymore and before i got similar error message like you.

I will try to declare the "swith_to_" subs in the "sub main" and will report about the results soon.

bek
Quote Reply
Re: relational dbman jpdeni manual In reply to
Hi FLTHiak,

this is for you:

playing in the desert of trial and error, i found a new "mysterie" of the relational_mod.
remeber:
the "interesting record will display in that way, you do a search and will the at the bottom of the user-info the items the user provides,ok?

The mod seemed to work only with a search in the field "User_ID".
The mystery: i got item links in the user-record-display after searching in the "keyword-field".

another top:for the error-mess you reported, uncomment/delete the sortorder and sortby in jpdenis code.


And for other interested people:
I worked out a set of subs to search in different db's for a keyword and to get results as a "link-list" on one page.
If there are interests i will post it, after beautifying the html.

bek
Quote Reply
Re: relational dbman jpdeni manual In reply to
hey bek:

-sounds like some interesting results: i sort of gave up on some of what I was trying to do.

Quote:
The mod seemed to work only with a search in the field "User_ID".
The mystery: i got item links in the user-record-display after searching in the "keyword-field".

-could you post the code for this? what i'm interested in is to show the number (only the number) of 'Items' the 'User' has posted.

eg. search results (html_record short display) would show:

user1 - 5 items
user2 - 2 items
user3 - 4 items

-and users would have the option of clicking on user#(user_db) or #item(item_db)

Quote:
another top:for the error-mess you reported, uncomment/delete the sortorder and sortby in jpdenis code.

my problem with this is i can't do without so or sb. I've installed another mod that lists 'User's by the first letter of the field 'name' and have a bar at the top of the list [a][c] etc and that links to the first letter of 'name'.

- i will just have to make sure there is more than one record in each.

other than these two problems relation mod is working really well -

thanks
-frank

[This message has been edited by FLThiak (edited November 02, 1999).]
Quote Reply
Re: relational dbman jpdeni manual In reply to
Hi FLTHiak,

a message in a hurry:
I dont' know, if I'm able to give you advices for your questions (I'm not a proffessional, only walking through desert of trial and error ;-)).
Short_record_displays in my "relation dbs" seems not to work correct. But I try to give you answers and will post the code for the keywordsearch soon. In the moment I'm very busy on my job, and i try to answer, ok? You' ll need a little patience.

bek