Jump to content

Is It Possible To Filter By Spain And English Characters?


Recommended Posts

Hi everyone,

 

I have a table with Spain texts, that contains Spain characters (for example, "ñ"). Is it possible to allow users to filter by Spain characters and by English too?

I mean, if a user looks for word "dona", the user can enter "doña" or "dona". Now only first case is displayed. Is it possible to display results in both cases? Maybe with some additional criteria?

 

Thank you for your time!

Link to comment
Share on other sites

Hello Cameron,

 

You can follow the following steps (it is not an easy solution, but I do not know a better one):

  1.  Add a field to your table, name it, for example, "latin_text". Here text without Spain characters will be stored.
  2. Edit your Submission Form, add a Header&Footer element, select the Footer element, click the "Source" button and enter the following code:
  3. <SCRIPT LANGUAGE="JavaScript">
    
    function latin_text()
    {
    var original_field = "original_text";
    var latin_field = "latin_text";
    
    original_field = "InsertRecord" + original_field;
    latin_field = "InsertRecord" + latin_field;
    
    var latin_text = document.getElementById(original_field).value;
    latin_text = latin_text.replace(/á/g, "a");
    latin_text = latin_text.replace(/é/g, "e");
    latin_text = latin_text.replace(/í/g, "i");
    latin_text = latin_text.replace(/ó/g, "o");
    latin_text = latin_text.replace(/ú/g, "u");
    latin_text = latin_text.replace(/ü/g, "u");
    latin_text = latin_text.replace(/ñ/g, "n");
    latin_text = latin_text.replace(/Ã/g, "A");
    latin_text = latin_text.replace(/É/g, "E");
    latin_text = latin_text.replace(/Ã/g, "I");
    latin_text = latin_text.replace(/Ó/g, "O");
    latin_text = latin_text.replace(/Ú/g, "U");
    latin_text = latin_text.replace(/Ü/g, "U");
    latin_text = latin_text.replace(/Ñ/g, "N");
    document.getElementById(latin_field).value = latin_text;
    }
    
    document.getElementById("caspioform").onsubmit=latin_text;
    </SCRIPT>
    
  4. Please, enter the name of your current field instead of "original_text" and the name of a new field instead of "latin_text".
    Now, when a user enters a text, a copy of the text without Spain characters is added to the "latin_text" field.
  5. Edit your Report DataPage, open the "Configure Search Fields" screen, add the "latin_text" field, and set the Hidden Form Element for the field; open the Logic tab and change the group "AND" to "OR".
  6. On the screen, add a Header&Footer element, select the Footer element, click the "Source" button and enter the following code:
<SCRIPT LANGUAGE="JavaScript">
function look_for()
{
document.getElementById("Value2_1").value = document.getElementById("Value1_1").value;
}
document.getElementById("caspioform").onsubmit=look_for;
</SCRIPT>

In my screen, the "original_text" is the first field, so I used "Value1_1". The "latin_text" is the second field, and I used "Value2_1" for it. Please, enter the order numbers of your fields instead of 1 and 2, if they are different.

 

Now, when a user enters a criteria, the text is copied to the second criteria and the text is searched in both Spain and English versions of the texts.

 

I hope, it helps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...