Use the find result as filter

In Passolo I can use the find dialog [ctrl+F] to list phrases that match a certain somewhat complex criteria, i.e. regular expressions. This lists the results in the lower right where I can step throug them using [F3]. Sometimes this is nice to see how the phrase fits with its neighbors. Sometimes I only want to see exactly these results.

I have tried the filter, especially the basic expression match, but this does not like regular expressions.

Right now I am trying to filter all phrases where the ID ends with [0-9]-FL" and the text contains letters, but this will change as I check other things...

 

Is there a way to use the find tool in the filter?

Parents
  • The Search and the Filter feature are separate and therefore Search results cannot simple be converted into a filter. From the functionality the Search is able to use regular expression while the Filter can use BASIC expressions from the object model to define filter. A combination of both functions (regular expressions and BASIC expressions) would be very complex to insert and maintain for users, so it was decided not to combine them.

    There is one possible solution, but it would require to develop a small macro. If you implement a system macro that is implementing the PSL_OnFilterTransString() event you implement on your own which entry is filtered or not. Of course you can use regular expressions within your macro and the Filter dialog allows it to pass a use defined string to the macro which makes it even more flexible.

    Trados Studio Filter Settings dialog box with options to filter strings by date, custom filter check, and basic expression. A custom string field is highlighted indicating where to input the macro.

    The Automation Help contains more information and a small code sample.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 5:15 AM (GMT 0) on 5 Mar 2024]
  • Thank you! It does work. My first experience with macros in Passolo.
    I have only one little request... I had made an error that caused the macro editor to be displayed for every phrase tested. I was not careful and had used it on my large project with over 30,000 phrases. I could find no way to make the filter stop calling the system macro, and was being queried 30,000 times (only the task manager could help). I would start to edit the macro, only to have it stop at the erroneous line once again, before I could type in Rem. Perhaps this option could be implemented in the future, as there is an inquiry if the macro should be stopped add a third button [disable system macro] or [reload changed macro].
  • This is the working macro which filters all source and target phrases and the phrase IDs, to make the filter work you must save this file "Filter Phrase.bac" in your macro-folder, set it as system macro, and then start the system macro (all using the Tools-ribbon and Macros-button).

    ''filters a phrase in the source, target or phrase id

    Sub Main
    Rem Do nothing, Only the PSL_OnFilterTransString is called from the filter dialog
    End Sub


    Rem This filters all strings that include a search text.
    Rem The search text is entered in the Filter dialog.
    Public Sub PSL_OnFilterTransString(TransString As PslTransString, ByVal FilterString As String, Display As Boolean)

    Display = False
    If InStr(1, TransString.Text, FilterString) > 0 Then
    Display = True
    ElseIf InStr(1, TransString.SourceText, FilterString) > 0 Then
    Display = True
    ElseIf InStr(1, TransString.ID, FilterString) > 0 Then
    Display = True
    End If

    End Sub

Reply
  • This is the working macro which filters all source and target phrases and the phrase IDs, to make the filter work you must save this file "Filter Phrase.bac" in your macro-folder, set it as system macro, and then start the system macro (all using the Tools-ribbon and Macros-button).

    ''filters a phrase in the source, target or phrase id

    Sub Main
    Rem Do nothing, Only the PSL_OnFilterTransString is called from the filter dialog
    End Sub


    Rem This filters all strings that include a search text.
    Rem The search text is entered in the Filter dialog.
    Public Sub PSL_OnFilterTransString(TransString As PslTransString, ByVal FilterString As String, Display As Boolean)

    Display = False
    If InStr(1, TransString.Text, FilterString) > 0 Then
    Display = True
    ElseIf InStr(1, TransString.SourceText, FilterString) > 0 Then
    Display = True
    ElseIf InStr(1, TransString.ID, FilterString) > 0 Then
    Display = True
    End If

    End Sub

Children
No Data