cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

creating a complex index sort key using a padded article number

naglists
1-Visitor

creating a complex index sort key using a padded article number

This was to make a field index that sorted on the document order of an
article. The sort key was complex, it was actually built up of
Section
Division
Article

Where some sections did not have Divisions, the articles were directly in
the Section. In other cases, the Articles were inside of Divisions inside
of Sections, so the ultimate sort-key was:
SSSS.DDDD.AAAA

A "real" one would probably look like:
0002.0004.0012

Or, Section 2, Division 4, Article 12.

Anyhow, this is the bit that padded the article number. Next comes the FOSI
fragment calling this function. Finally, the FOSI fragment where the entry
was added to the index.

function get_article_num_sort_key(win, oid) {
return reverse(substr(reverse('0000' .
oid_xpath_string($oid,'count(preceding-sibling::article)')),1,4));
}


<att>
<fillval attname="my_fosi::get_article_num_sort_key" attloc="system-func"&lt;br"/>fillcat="savetext" fillchar="conrule">
<charsubset>
<savetext textid="article_num-sortkey.txt">
</charsubset>
</att>

<savetext textid="field-index.app"&lt;br"/>conrule="<ixpt>,number_fld-value.txt,</ixpt>,<ixkey>,number_fld-sortkey.txt,\
\,article_num-sortkey.txt,</ixkey>,<ixsub1>,name_fld-value.txt,</ixsub1>,<ixsub2>,change_fld-value.txt,</ixsub2>,<ixsub3>,description_fld-value.txt,</ixsub3>,<ixsub4>,article-no.txt,</ixsub4>,<ixpgstr>,bodyfolio,</ixpgstr>"
placemnt="after" append="1">

--
Paul Nagai
0 REPLIES 0
Announcements

Top Tags