Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Automatic translation with dictionary table

Featured Replies

  • Newbies

In my FileMaker solution, I would like to automatically translate certain fields from my "Products" table into fields in my "Products_2" table using a dictionary stored in my "Dictionary" table.

I suppose I should somehow use the Substitute function, but how do I retrieve (all) the values from the "Dictionary" table?

I don't think you need all the values from the "Dictionary" table. You only need the matching value, which you can get through a relationship.

However, I would question the setup you describe. Why would you have two Products tables? And what are these "certain fields" that need translation? I suspect the real problem is somewhere else.

 

Edited by comment

  • Author
  • Newbies

The fields that need translation are fields with a lot of text, like for example the "Description" field. Several words in that field will need to be translated, so there is more than just one matching value. I might be able to keep it all in one table, but for clarity I have separated my data into a danish table (Products) and a norwegian table (Products_2). This shouldn't affect the translation challenge, I suppose.

3 hours ago, LoisLane said:

Several words in that field will need to be translated, so there is more than just one matching value.

I see. Well, you could use Substitute() in a recursive custom function - but you need to keep in mind that (a) the Substitute() function is case-sensitive, (b) it works with patterns, not words, and (c) cumulative application can have unexpected results (as each iteration works on the result of previous ones).

If these limitations do not affect you, try a custom function such as:

 MultiSubstitute ( text ; searchValues ; replaceValues ) =

Let ( [
countValues = ValueCount ( searchValues ) ;
searchString = GetValue ( searchValues ; 1 ) ;
replaceString = GetValue ( replaceValues ; 1 ) ;
result = Substitute ( text ; searchString ; replaceString )
] ;
Case (
countValues > 1 ; MultiSubstitute ( result ; RightValues ( searchValues ; countValues - 1 ) ;  MiddleValues ( replaceValues ; 2 ; countValues - 1 ) ) ;
result
)
)

To use the function, define a relationship to the Dictionary table using the x relational operator, then make your calculation =

MultiSubstitute ( YourField ; List ( Dictionary::SearchString ) ; List ( Dictionary::ReplaceString ) )

 

Alternatively consider a scripted approach using the Perform Find/Replace script step in a loop.

  • Author
  • Newbies

Thanks a lot for your quick, thorough and very useful answer. It works perfectly! I am aware of the challenges you mention, but I have my ways to work around them :)

 

  • Author
  • Newbies

So far, so good... but a new challenge has come up:

The records in the "Dictionary" table need to be inserted to the MultiSubstitute function in a certain order. Unfortunately, the sort order I have made in the "Dictionary" table is ignored which leads to errors. How do I solve this problem?

20 minutes ago, LoisLane said:

the sort order I have made in the "Dictionary" table is ignored

Sort the related Dictionary records, in the relationship definition.

  • Author
  • Newbies

Of course! Thanks again :)

  • 3 weeks later...

Is it possible you give us an example basis, I aim my test in my same topic that want to Lois Lane.
My subject here

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.