View Single Post
Old 09-26-2011, 06:43 AM   #10
arspr
None
arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.arspr ought to be getting tired of karma fortunes by now.
 
Posts: 377
Karma: 240172
Join Date: Mar 2011
Location: Madrid, Spain
Device: Sony PRS-650 >>> Kobo Aura HD
Sorry for the triple post...

Something is not working properly or probably I'm doing something wrong...

Look at the attached screenshot (at the selected book). As a test I've set languages as Latin (lat) and Spanish (esp) because I wanted to make a stress test (ISO alphabetical sorting is different from English names).

The trouble is that the "Original Language? (#original)" doesn't work fine. It should give Yes, but it returns No. I post its modified and updated code:
Code:
{#original:'strcmp(field('#original_language'),language_strings(field('languages'),0), 'No', 'Yes', 'No')'}
I firstly thought it was because of the different sorting (look at Languages and Original Languages columns). Because of it I made an auxiliary column "aux (#aux)" with just:
Code:
{#aux:'language_strings(field('languages'),0)'}
And apparently, the sorting is automatically fixed inside the language_strings function. Apparently #aux and #original_language are the same.

So, why does strcmp evaluate them as different? What am I doing wrong?
Attached Thumbnails
Click image for larger version

Name:	Clip.jpg
Views:	58
Size:	607.5 KB
ID:	76985  
arspr is offline   Reply With Quote