Jump to content
Server Maintenance This Week. ×

Perform find script nightmare


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

Recommended Posts

Hi 

I have a text field with a "from" text value

However if the field content is (An) as 2 characters I receive AN and ANN and ANNA and ANIE and so on

How to constrain just to the actual value in the Field so I do not get the whole bunch of words starting or containing those letters?

It must be really simple but I am unable to do it

Thanks

 

Link to comment
Share on other sites

1. To find the exact content (of the entire field), search for ==An.

2. To make the search case-sensitive, set the field's indexing language to Unicode.

Thank you for your kind reply but I forgot to mention this is one step ina script and for mysterious reasons I cant get it to work  while it works perfectly if I do a manual search

the script is like this:

Perform Find [ Specified Find Requests: Find Records; Criteria: Mails::Kind: “Message” AND Mails::How Many Messages: “=” ]

[ Restore ]

Sort Records [ Keep records in sorted order; Specified Sort Order: Mails::From; ascending Mails::DateTime; descending ]
[ Restore; No dialog ]

Loop

Perform Find [ Specified Find Requests: Find Records; Criteria: Mails::Kind: “Message” AND Mails::How Many Messages: “=” ]

[ Restore ]

Go to Record/Request/Page

[ First ]
Enter Find Mode [ ]
Set Field [ Mails::From; "==" & Left ( Mails::From ; Length ( Mails::From ) ) ] Perform Find [ ]
Set Field [ Mails::How Many Messages; Get ( FoundCount ) ]
If [ Get ( FoundCount ) > 1 ]

Replace Field Contents [ Mails::How Many Messages; Current contents ] [ No dialog ]

End If End Loop 

 

However in the search field the script only Paste "==" and not the rest

 

I tried to use th "Insert calculated result" but the same thing happens

How could I solve this problem?

There is not way that i am aware of to add operators in a calculation as they all vanish

 

 

Link to comment
Share on other sites

Allow User Abort [ON]  // once script is working properly switch to OFF
Set Error Capture[ON]
Perform Find 
[ Specified Find Requests: Find Records; Criteria: Mails::Kind: “Message” AND Mails::How Many Messages: “=” ]
[ Restore ] 

Sort Records [ Keep records in sorted order; Specified Sort Order: Mails::From; ascending Mails::DateTime; descending ]
[ Restore; No dialog ]

New Window[ window name=process, height=10, width=10, left= -100, top=0 ]    // process routine off screen
Loop
    Enter Find Mode []

    Set Field [ Mails::How Many Messages; "=" ]
    Perform Find []
   
Exit Loop if [Get ( FoundCount ) = 0]
    Go to Record/Request/Page  [ First ]
    Set Vaiable [$from, 
Left ( Mails::From ; Length ( Mails::From ) ) ]
    Enter Find Mode [ ]
    Set Field [ Mails::From; "==" & $from
    Perform Find [ ]
    Set Field [ Mails::How Many Messages; Get ( FoundCount ) ]
    If [ Get ( FoundCount ) > 1 ]
        Replace Field Contents [ Mails::How Many Messages; Current contents ] [ No dialog ]
    End If
End Loop 
Close Window [current]

Hope this helps!

Link to comment
Share on other sites

1. In Find mode a non-global field has no value; that's why all you get is the constant "=="; you could capture the field value in a $localVariable before entering Find mode and use that as search value; or use Find Matching records [ Replace ; Mails::From ]

2. Left ( Mails::From ; Length ( Mails::From ) ) is the same as Mails::From

3. What is your script supposed to do, anyway? Counting the number of distinct “From” values with empty count and storing the result in the Mail table itself?

Not sure if that makes sense, but you could write a much shorter script:

Set Error Capture [ on ]
Perform Find [ Specified Find Requests: Find Records; Criteria: Mails::Kind: “Message” AND Mails::How Many Messages: “=” ][ Restore ]
If [ Get ( FoundCount ) ]
  Sort Records [ Keep records in sorted order; Specified Sort Order: Mails::From; ascending Mails::DateTime; descending ]
  [ Restore; No dialog ]
  Replace Field Contents [
    Mails::How Many Messages
;
    Let ( theCount = GetSummary ( Mails::sCountAll ; Mails::From ) ; Case ( theCount > 1 ; theCount ) ) 
  ] 

End If

where Mails::sCountAll is a summary field that counts a guaranteed non-empty field.

Edited by eos
Link to comment
Share on other sites

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