Jump to content

This topic is 8660 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have 2 databases. DATABASE1 and DATABASE2. And in both the database files i have a field called FIRSTNAME.

So what i want to do is i want to search a first name from 2 databases.

Like in my search page if i enter somename and click search button then it should search from 2 databses.Can this be done.If so plese send me the code.(check is it possible to display results in 2 pages for each databases) .

Very Urgent!

thanx

sree

I came to know that we can search 2 databases at one click by using INLINE tag. Can anybody give me the code,how to search 2 databases from a single search page. Suppose to search FIRSTNAME from 2 databases.

Please write me code for this.

Thanx

sree

Posted

Comeon yaar. Post your replies. Possibe or not .

Not even a single reply. Impossible yaar.Someone must be knowing.Help me pleaseeeeeeeeeeeeee

Posted

Here is a basic method which is working. I have two database named names1.fp5 and names2.fp5 they both have a field called 'fname' and a field called 'sname'.

This is the input form:

<body>

<form action="http://10.0.1.2:1154/FMPro" method="post">

<input type="hidden" name="-db" value="names1.fp5">

<input type="hidden" name="-format" value="name_list.html">

<input type="hidden" name="-lay" value="allfields">

<input type="text" name="fname">

<input type="submit" name="-find" value="Search">

</form>

</body>

Here is the format file which lists the results:

<body>

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[FMP-InlineAction: -db="names2.fp5", -lay="allfields", fname="{FindValueItem}", -find]

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[/FMP-InlineAction]

</body>

Hope this helps.

Garry

Posted

Here is an enhanced version. The last version would have a problem if the fname being searched for was not in names1.fp5, i.e. a 'No Records Found' alert would be displayed and the name_list.html format file would not open and hence the names2.fp5 file would not be searched. So the new search form uses -view and -token tags with both searches using InlineAction tags.

<form action="http://10.0.1.2:1154/FMPro" method="post">

<input type="hidden" name="-db" value="names1.fp5">

<input type="hidden" name="-format" value="name_list.html">

<input type="text" name="-token">

<input type="submit" name="-view" value="Search">

</form>

name_list.html:

<body>

[FMP-InlineAction: -db="names1.fp5", -lay="allfields", fname="{CurrentToken}", -find]

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[/FMP-InlineAction]

[FMP-InlineAction: -db="names2.fp5", -lay="allfields", fname="{CurrentToken}", -find]

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[/FMP-InlineAction]

</body>

What do I win? ;-)

Garry

Posted

Thanx Garry it worked. U r a good programmer. Actually i tried for this. But i wrote all inline tags in search page itself.So it didn't worked for me. Any how thanx alot garry. Can u help me in this. I hope u can. I want to display the results in 2 different pages.I mean display results of the DB1 in one page and DB2 in 2nd page.

Can u write me the code.

thanx

sree

Posted

Ok, you need to change the format file to include a form as shown:

<body>

[FMP-InlineAction: -db="names1.fp5", -lay="allfields", fname="{CurrentToken}", -find]

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[/FMP-InlineAction]

<form action="http://10.0.1.2:1154/FMPro" method="post">

<input type="hidden" name="-db" value="names2.fp5">

<input type="hidden" name="-format" value="name_list2.html">

<input type="hidden" name="-token" value="[FMP-CurrentToken]">

<input type="submit" name="-view" value="List 2">

</form>

</body>

Then create a second format file; to show the names from the second db.

<body>

[FMP-InlineAction: -db="names2.fp5", -lay="allfields", fname="{CurrentToken}", -find]

[FMP-Record]

[FMP-Field:fname] [FMP-Field:sname]<br>

[/FMP-Record]

[/FMP-InlineAction]

</body>

This will do the job. However, you do not have to use Inline tags for the second format file, you can use the standard [FMP-Record] tags etc.

Garry

This topic is 8660 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.