<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Thanks for this tip Jean-Claude,<br>
    <br>
    This is unknown material for me, but with some luck not for one of
    my colleagues.<br>
    And if not: this can be an opportunity to learn more about this
    option. <span class="moz-smiley-s1"><span>:-)</span></span><br>
    <br>
    Thanks & Regards<br>
    Fred<br>
    <br>
    <div class="moz-cite-prefix">Op 5-12-2017 om 18:35 schreef
      Jean-Claude Dauphin:<br>
    </div>
    <blockquote type="cite"
cite="mid:CALkRQxf0r-PKK6fgskJNaqm4JWONvqEg4gxjG91KUKzk6zGgng@mail.gmail.com">
      <div dir="ltr">
        <div class="gmail_default" style="">​​</div>
        <div class="gmail_default" style="">
          <div class="gmail_default">​​</div>
          <div class="gmail_default">Hello Fred,</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">You can export yr database into an
            iso file and import into J-ISIS. Then you can write a Groovy
            script to reformat your records.</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">Once your database OK, you can
            export the database into an iso file and get it back into
            ABCD.</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">You will finds below a small script
            example.</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">Best wishes,</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default">JC</div>
          <div class="gmail_default"><br>
          </div>
          <div class="gmail_default" style="">#! v215Corrector_1</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.common.IConnection</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.client.ConnectionNIO</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.client.ClientDbProxy</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.common.IDatabase</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.common.Global</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.record.IRecord</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.record.Record</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.record.IField</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.record.StringOccurrence</div>
          <div class="gmail_default" style="">import
            org.unesco.jisis.corelib.record.Subfield</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">class Corrector {</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">    private ClientDbProxy
            db ;</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">    Corrector(String
            dbName) {</div>
          <div class="gmail_default" style="">        // Initialize the
            server parameters</div>
          <div class="gmail_default" style="">        def username =
            "admin";</div>
          <div class="gmail_default" style="">        def password =
            "admin";</div>
          <div class="gmail_default" style="">        def port = "1111";</div>
          <div class="gmail_default" style="">        def hostname =
            "localhost";</div>
          <div class="gmail_default" style="">        def dbHome =
            "DEF_HOME";</div>
          <div class="gmail_default" style="">        // Establish a
            connection to the server</div>
          <div class="gmail_default" style="">        def connection =
            ConnectionNIO.connect(hostname, Integer.valueOf(port),
            username, password);</div>
          <div class="gmail_default" style="">    </div>
          <div class="gmail_default" style="">        // Create a
            Database object bind to this server</div>
          <div class="gmail_default" style="">        db = new
            ClientDbProxy(connection)</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">        // Open the
            database</div>
          <div class="gmail_default" style="">       
             db.getDatabase(dbHome, dbName, Global.
            DATABASE_DURABILITY_WRITE)</div>
          <div class="gmail_default" style="">       
             //db.getDatabase(dbHome, dbName, Global.
            DATABASE_BULK_WRITE)</div>
          <div class="gmail_default" style="">    }</div>
          <div class="gmail_default" style="">    </div>
          <div class="gmail_default" style="">    def correctDb() {</div>
          <div class="gmail_default" style="">       Record
            currentRecord ;</div>
          <div class="gmail_default" style="">        // Get first
            record</div>
          <div class="gmail_default" style="">       currentRecord =
            db.getFirst();</div>
          <div class="gmail_default" style="">        // Iterate over
            the records in the database until nomore</div>
          <div class="gmail_default" style="">   </div>
          <div class="gmail_default" style="">        </div>
          <div class="gmail_default" style="">        def i = 0 ;</div>
          <div class="gmail_default" style="">        //while (i <
            10) {</div>
          <div class="gmail_default" style="">        while
            (currentRecord != null) {</div>
          <div class="gmail_default" style="">            // Process the
            record-></div>
          <div class="gmail_default" style="">           
            processRecord(i, currentRecord) ;</div>
          <div class="gmail_default" style="">           </div>
          <div class="gmail_default" style="">            i += 1 ;</div>
          <div class="gmail_default" style="">           </div>
          <div class="gmail_default" style="">            // Get the
            next sequential record in the mfn order</div>
          <div class="gmail_default" style="">            currentRecord
            = db.getNext();</div>
          <div class="gmail_default" style="">        } </div>
          <div class="gmail_default" style="">        // Close the
            database</div>
          <div class="gmail_default" style="">        db.close();</div>
          <div class="gmail_default" style=""> </div>
          <div class="gmail_default" style="">    }</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">    def processRecord(i,
            rec) {</div>
          <div class="gmail_default" style="">        String doctype =
            "" ;</div>
          <div class="gmail_default" style="">        String v215 = "" ;</div>
          <div class="gmail_default" style="">        Long mfn =
            rec.getMfn() ;</div>
          <div class="gmail_default" style="">         </div>
          <div class="gmail_default" style="">        IField field ;  </div>
          <div class="gmail_default" style="">        </div>
          <div class="gmail_default" style="">        //sous-champ 1</div>
          <div class="gmail_default" style="">        field
            =rec.getField(1) ;</div>
          <div class="gmail_default" style="">        def occ =
            field.getOccurrence(0) ;</div>
          <div class="gmail_default" style="">        if (occ != null) {</div>
          <div class="gmail_default" style="">            doctype =
            occ.getSubfield('a') ;</div>
          <div class="gmail_default" style="">        }</div>
          <div class="gmail_default" style="">         </div>
          <div class="gmail_default" style="">        </div>
          <div class="gmail_default" style="">        // sous-champ 215</div>
          <div class="gmail_default" style="">        field =
            rec.getField(215) ;</div>
          <div class="gmail_default" style="">        occ =
            field.getOccurrence(0) ;</div>
          <div class="gmail_default" style="">        // s'il existe</div>
          <div class="gmail_default" style="">        if (occ != null
            && occ.hasSubfields()) {</div>
          <div class="gmail_default" style="">            Subfield[]
            subfields = occ.getSubfields() ;</div>
          <div class="gmail_default" style="">            if
            (subfields.length == 1 &&
            subfields[0].getSubfieldCode() == 'a') {</div>
          <div class="gmail_default" style="">                v215 =
            occ.getSubfield('a') ;</div>
          <div class="gmail_default" style="">            }</div>
          <div class="gmail_default" style="">        }</div>
          <div class="gmail_default" style="">        if (doctype=="ART"
            && v215=="1 vol. ()" ) {</div>
          <div class="gmail_default" style="">             println
            '\n==========\nrecord corrected mfn : ' + mfn +' doctype:'+
            doctype + ' field value:' + field.getStringFieldValue() ;</div>
          <div class="gmail_default" style="">            </div>
          <div class="gmail_default" style="">           
             rec.removeField(215) ;</div>
          <div class="gmail_default" style="">            </div>
          <div class="gmail_default" style="">           
             db.updateRecordEx(rec) ;</div>
          <div class="gmail_default" style="">        }</div>
          <div class="gmail_default" style="">    }</div>
          <div class="gmail_default" style=""> </div>
          <div class="gmail_default" style="">}</div>
          <div class="gmail_default" style=""><br>
          </div>
          <div class="gmail_default" style="">def corrector=new
            Corrector("Albert-Groovy") ;</div>
          <div class="gmail_default" style="">corrector.correctDb() ;  </div>
          <div class="gmail_extra" style=""><br>
            <div class="gmail_quote">On Tue, Dec 5, 2017 at 5:36 PM,
              fred train <span dir="ltr"><<a
                  href="mailto:fred_train@xs4all.nl" target="_blank"
                  moz-do-not-send="true">fred_train@xs4all.nl</a>></span> wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">Hello guru's<br>
                <br>
                We have repeatable field called Keywords.<br>
                This field contains for historical reasons also coded
                location information.<br>
                A Keyword field could have entries like<br>
                Colored; upside; metal; painted; GLD; LIM; NLD; sale<br>
                The semicolons are added by the PFT. Each keyword has
                its own record.<br>
                <br>
                We have created a new repeatable field called Locations.
                And the location entries from the keywords should be
                moved to the new Locations field and also translated
                into more readable strings.<br>
                The end-effect after the operation should look like:<br>
                <br>
                Keyword: Colored; upside; metal; painted; sale<br>
                Locations: Gelderland(GLD); Limburg(LIM); Netherlands<br>
                <br>
                The idea was to apply a global change for each of the
                keywords GLD, LIM and NLD.<br>
                I can modify the strings into their target strings (e.g.
                GLD becomes Gelderland) in the keywords.<br>
                But the Move option in Global change moves all entries
                of Keyword to Locations.<br>
                <br>
                Is there a solution for my problem?<br>
                In other words: Is it possible with Global Change or
                another option to move some entries from the source
                repeatable field to a target repeatable field?<br>
                Regards<br>
                Fred<br>
                <br>
                ______________________________<wbr>_________________<br>
                isis-users mailing list<br>
                <a href="mailto:isis-users@iccisis.org" target="_blank"
                  moz-do-not-send="true">isis-users@iccisis.org</a><br>
                To manage your own subscription options go to: <a
                  href="http://lists.iccisis.org/listinfo/isis-users"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.iccisis.org/listi<wbr>nfo/isis-users</a><br>
                Or contact Henk Rutten: <a
                  href="mailto:hlrutten@xs4all.nl" target="_blank"
                  moz-do-not-send="true">hlrutten@xs4all.nl</a><br>
              </blockquote>
            </div>
            <br>
            <br clear="all">
            <div><br>
            </div>
            -- <br>
            <div class="gmail_signature">
              <div dir="ltr">Jean-Claude Dauphin<br>
                <br>
                <a href="mailto:jc.dauphin@gmail.com" target="_blank"
                  moz-do-not-send="true">jc.dauphin@gmail.com</a><br>
                <br>
                <a href="http://kenai.com/projects/j-isis/"
                  target="_blank" moz-do-not-send="true">https://github.com/J-ISIS</a><br>
                <br>
                <a href="http://www.unesco.org/isis/" target="_blank"
                  moz-do-not-send="true">http://www.unesco.org/isis/</a><br>
                <a href="http://www.unesco.org/idams/" target="_blank"
                  moz-do-not-send="true">http://www.unesco.org/idams/</a><br>
                <a href="http://www.greenstone.org/" target="_blank"
                  moz-do-not-send="true">http://www.greenstone.org</a></div>
            </div>
          </div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Dec 5, 2017 at 5:36 PM, fred
            train <span dir="ltr"><<a
                href="mailto:fred_train@xs4all.nl" target="_blank"
                moz-do-not-send="true">fred_train@xs4all.nl</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello
              guru's<br>
              <br>
              We have repeatable field called Keywords.<br>
              This field contains for historical reasons also coded
              location information.<br>
              A Keyword field could have entries like<br>
              Colored; upside; metal; painted; GLD; LIM; NLD; sale<br>
              The semicolons are added by the PFT. Each keyword has its
              own record.<br>
              <br>
              We have created a new repeatable field called Locations.
              And the location entries from the keywords should be moved
              to the new Locations field and also translated into more
              readable strings.<br>
              The end-effect after the operation should look like:<br>
              <br>
              Keyword: Colored; upside; metal; painted; sale<br>
              Locations: Gelderland(GLD); Limburg(LIM); Netherlands<br>
              <br>
              The idea was to apply a global change for each of the
              keywords GLD, LIM and NLD.<br>
              I can modify the strings into their target strings (e.g.
              GLD becomes Gelderland) in the keywords.<br>
              But the Move option in Global change moves all entries of
              Keyword to Locations.<br>
              <br>
              Is there a solution for my problem?<br>
              In other words: Is it possible with Global Change or
              another option to move some entries from the source
              repeatable field to a target repeatable field?<br>
              Regards<br>
              Fred<br>
              <br>
              ______________________________<wbr>_________________<br>
              isis-users mailing list<br>
              <a href="mailto:isis-users@iccisis.org" target="_blank"
                moz-do-not-send="true">isis-users@iccisis.org</a><br>
              To manage your own subscription options go to: <a
                href="http://lists.iccisis.org/listinfo/isis-users"
                rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.iccisis.org/listi<wbr>nfo/isis-users</a><br>
              Or contact Henk Rutten: <a
                href="mailto:hlrutten@xs4all.nl" target="_blank"
                moz-do-not-send="true">hlrutten@xs4all.nl</a><br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">
              <div>Jean-Claude Dauphin<br>
                <br>
                <a href="mailto:jc.dauphin@gmail.com" target="_blank"
                  moz-do-not-send="true">jc.dauphin@gmail.com</a><br>
                <br>
                <a href="http://kenai.com/projects/j-isis/"
                  target="_blank" moz-do-not-send="true">https://github.com/J-ISIS</a><br>
                <br>
                <a href="http://www.unesco.org/isis/" target="_blank"
                  moz-do-not-send="true">http://www.unesco.org/isis/</a><br>
                <a href="http://www.unesco.org/idams/" target="_blank"
                  moz-do-not-send="true">http://www.unesco.org/idams/</a><br>
                <a href="http://www.greenstone.org" target="_blank"
                  moz-do-not-send="true">http://www.greenstone.org</a></div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>