Jump to content

Search Result problem


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

Recommended Posts

  • Newbies

Ok...here is my situation:

Database:

Field 1 (10 options): 1, 2, 3, 4, 5, 6, 7, 8, 9, 0

Field 2 (10 options): A, B, C, D, E, F, G, H, I, J

What I need to do is find how many records have both 3, and D as field entries. And I need to output to a webpage. I dont know if I'm just having major brain blockage here but I cant think of how to do this.

Link to comment
Share on other sites

You can select each field as usual; e.g.:

[FMP-ValueList: Field1, List=Options1]

<input type="radio" name="Field1" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]

[/FMP-ValueList]

[FMP-ValueList: Field2, List=Options2]

<input type="radio" name="Field2" value="[FMP-ValueListItem]" [FMP-ValueListChecked]>[FMP-ValueListItem]

[/FMP-ValueList]

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


Then in your format file you would use:
This many records have both: [FMP-CurrentFoundCount]

Hope this helps.

Garry

Link to comment
Share on other sites

You could also create a calc field in the db which concatenates the two fields. Use this field to generate a value list and as the search field.

The value list might get a bit long, but at least users will only see values that are in the database (ie, they cannot search for invalid combinations).

Link to comment
Share on other sites

  • Newbies

Ok...only problem is: On one web page I need to find out how many 1C's there are how many 8A's, and how many 5D's there are. How would I make the link to the page and how do I poll this kinda comparisons all on one page?

Example output:

1:A: 4

1:B: 0

1:C: 8

2:G: 2

2:D: 1

etc.

Link to comment
Share on other sites

First, as Vaughan indicated, concatenate the fields with a calc field.

Then have another database with the 100 combinations as the key field data for each record. Relate the main file/table to the new file/table with the calc field. Create a portal, in the new file, and a count field.

You can now sort and list the various combinations with counts.

This one method which springs to mind after a big lunch in Sydney smile.gif

All the best.

Garry

Link to comment
Share on other sites

Here is a solution:

1. Create a Calculated field called "fieldcombo": (Field1 & Field2)

2. Create a Relationship "combos" on the same file using the "fieldcombo" field. (Self Join)

3. Create a Calculated field called "count": with value (1)

4. Create a Calculated field called "count_combos": Count(combos::count)

3. Create a Layout "combo_list"; include fields "fieldcombo" and "count_combos"

Use this Javascript:

<body><script>

i = 1 ;

[FMP-Record]

[FMP-If:count_combos.gt.]

x = [FMP-Field:count_combos] ;

if (i == x)

{

document.write("[FMP-Field:fieldcombo] [FMP-Field:count_combos]<br>") ;

i = 1 ;

}

else

{i++ ;} ;

[/FMP-If]

[/FMP-Record]

</script>

</body>


And use the URL (or equivalent Form):

http://localhost:1154/FMPro?-db=combotest.fp5&-lay=combos_list&-format=combo_list.html&-sortfield=count_combos&-sortorder=Descend&-sortfield=fieldcombo&-findall

Hope this helps.

Garry

Link to comment
Share on other sites

This topic is 7814 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.