Jump to content

Find in multiple fields + extra's


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

Recommended Posts

Perhaps the solution is quite easy but I can't sort it out right.

Could you please help me with the scripts for these three buttons:

3 buttons, a global field "input" and a calculation field "counter"

I have a global field to put the search criteria in and I need:

  • 1= A FIND button that takes the word(s) or number(s) of the global field "input" and searches it in field "A" "B" "C" "D" & "E". When the value is found (lets say) in field "D" at recordnumber 321, it would be nice to have the field highlighted or [color:"red"] something that puts focus on field "D" of record 321 and also put the find count result in field "counter".
  • 2= A NEXT button that takes you to the next value, (lets say) field "A" in recordnumber 654 until there is no more match. When that happends it would be nice to show all records again but stay at that current record.
  • 3= A SELECT find button that puts the find count in the field "counter" and go's to the LAST found but is showing ALL the records (sorted by RecID).

thanks in advance... wink.gif

Link to comment
Share on other sites

One way to search in mutiple fields simultaneously is to create a claculation field that concatenates all the others together, and perform the find on this calculation field.

You could then use the PatternCount() function with conditional If statements to determine which field contains the global value, and use the "Go to Field []" step to select the field.

The next button would go to the next record and repeat the above script.

I have no idea what your SELECT button does!

To go to the last record in the found set just use the "Go to Record [last]" step. To make a field display the number of records found, create an unstored calc field with the function "Status(CurrentFoundCount)".

Link to comment
Share on other sites

  • 2 months later...

Thanks Vaughan for your help!

I figured it out... just needed at kick start grin.gif

To make my layout more easy, I need your help again with my Next button.

It would be great if I have a FIND button that go's to the next found result, when it is pressed again and beeps when it is the last one.

After my find I have a Show All Records so Go to Next Record is not an option.

Was thinking about a Set Field [""] function to mark the found ones, but perhaps that's silly. I just don't know how to go to the next record skipping records that doesn't meet the find criteria.

Many thanks if you have the time to help me out,

Rakesh

Link to comment
Share on other sites

Sticking with Vaughns concatenated calc idea:

fields:

A text

B text

C text

g_Find global

FindCalc:

case(A=g_Find,1

B=g_find,2

C=g_find,3)

you could implement a find of these fields without entering find mode by typing in the match criteria in g_Find and pressing your "Next Found" button.

Your "Next Found" button would run script:

loop

go to rec/request next

if [FindCalc>0]

if [FindCalc=1]

go to field A

end if

if [FindCalc=2]

go to field B

end if

if [FindCalc=3]

go to field C

end if

halt script

end if

go to rec/req (Next/exit after last)

EndLoop

Beep

HTH

-Raz

Link to comment
Share on other sites

You're basically trying to save a found set

Thuis can be done, though it can be slow for large found sets

In brief:

Create a RecordID field, unique

After you've run the search run a looping script that puts in a global text field the RecordIDs of the found set, separated by a return

Then you can navigate in your found set by using another global field in which you'll enter by script the RecordID of the desired record and then issue a Go To related Record Step

Your navigation script will be like:

Go to first found record:

Set field (TheGlobal, (Leftwords(TheGlobalWithIDs,1)

Go To Related record /(Relationship TheGlobal::RecordID)

Go to last found record

Set field (TheGlobal, (Rightwords(TheGlobalWithIDs,1)

GTRR ...

To navigate next/previous found record is trickier: you'll have to memorize in a third global field the word chosen in the previous step:

Go to next found record becomes

Set field (TheGlobal, (MiddleWords(TheGlobalWithIDs,gPreviousWord+1,1)

Set field (gPreviousWord, gPreviousWord+1)

GTRR

(I've used a similar method to create a fixed portal:

ftp://ftp.fmfiles.com/download/devhaven/tipstricks/portal/FixedPortalNew.sit

ftp://ftp.fmfiles.com/download/devhaven/tipstricks/portal/FixedPortalNew.zip)

The method has the FM built-in limit of 64k characters in the global field

Link to comment
Share on other sites

Thanks Razumovsky for your comments.

I am to much of a newbie to understand much about concatenated calculations. Do you know where I could get information to learn more about it?

To explain my script a bit more:

I have records that the user can mark ON or OFF

What I wanted is a next (and previous) button that go's to the next record that has marker ON.

What I created is this scipt:

1. If [the current record has Marker ON]

2. Set field [memorized record (*so I can return there later)]

3. Enter Find Mode

4. Set field [look for marker ON]

5. Perform Find

6. Go to Related [memorized record, which has self-relationship(*returning)]

7. If [status(CurrentRecordNumber) = total found record]

- beep

8. else

- go to Record [Next]

9. end if

10. Show all records

ELSE (if the current record doesn't have the marker ON)

1. Enter Find Mode

2. Set Field [look for marker ON]

3. Perform Find

4. If [Error 401]

-beep

5. End If

6. Show All records

I should adjust it when the user is not on a record with Marker ON that it goes to one that is ON from where user currently is and not the first Marker ON found in the database. But that's for the next level.

Anyway, perhaps this can all be much easier with concatenated calculations...

but how exactly I would not know.

Thanks for your time.

Link to comment
Share on other sites

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