Jump to content

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

Recommended Posts

In my solution, I have a table that lists all possible errors, and each of them have a unique ID like ERR001.

I have another file containing a dictionary table with global fields that corresponds to the error messages and are filled according to the language of the user. For example, this table has a field ERR001 that will contains the message to be displayed when error number 1 occurs.

I would like to have a field in the Error table that is the error message from the correct Dictionary field, based on the ID of the error record.

What I would like to do is something like D::$ID, where D is the Dictionary table and $ID is the ID of the error.

I tried using getField but I could not make it work using a reference in another file.

 

Any tips would be appreciated

Link to comment
Share on other sites

I don't understand your description - esp the part about global fields. IMHO, you should have either:

  • a table where each unique ErrorID is a record, and there is a field for each language containing the message in that language;

or (preferably, IMHO):

  • a table where each message is a separate record, with fields for ErrorID, Language and Message.
Link to comment
Share on other sites

Thanks for the answer. I will note these answer for further development, but in my current project I really have to use a file that have the messages as fields. Can you think of any other way I could achieve it ?

Here more description:

I have a table that contains error messages in different fields. I can only add fields for additional messages in this table.

The second table, in a separate file, contains a record for each error. I would like to add a field to this table that would reference the correct field in the other table using its name.

I know this is not the preferred architecture but I have to work this way. The reason is that all displayed message have to be in a table that has a record for each language so we can easily add new languages

Any ideas ?

Link to comment
Share on other sites

I am afraid I still don't follow this. Let us have a simple example:

ErrorID    Language    Message
ERR001     English     User canceled action
ERR001     French      L’utilisateur a annulé l’action
ERR002     English     Memory error
ERR002     French      Erreur de mémoire

How exactly would this be represented in your Dictionary table?

Next question: what relevant fields are in the target table, and what would they contain for the purpose of this example?

 

26 minutes ago, Anthony said:

The reason is that all displayed message have to be in a table that has a record for each language so we can easily add new languages

I don't think that's a good reason to have a flawed structure. On the contrary, you'll find it easier to add new languages and new error codes if your structure is normalized: i.e. a table of codes, a table of languages (optional) and a table of messages.

 

 

Edited by comment
Link to comment
Share on other sites

So the dictionary would look like this if the user selected English as his language:

ERR001                 ERR002          ERR003

User canceled action   Memory error    Device disconnected

This table contains only global fields and there is a script that load the values according to the chosen language (There is another table containing the same messages, one record for each language, but we should not have to deal with it).

The error table with relevant fields:

ErrorID       Description                             Message

ERR001        Occurs when action is cancelled         User canceled action

ERR002        Occurs when the user's machine...       Memory error

ERR003        Occurs when the device is ...           Device disconnected

Link to comment
Share on other sites

25 minutes ago, Anthony said:

This table contains only global fields and there is a script that load the values according to the chosen language

I am convinced you are going about this the wrong way, and making it much more complicated than it needs to be.

As an exercise only, here's a file that shows how to get "the error message from the correct Dictionary field, based on the ID of the error record" as you originally asked.  But I would strongly recommend against using this method.

 

 

Dict.fp7

Link to comment
Share on other sites

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