on 2016 Mar 16 1:50 PM
Hallo Community.
i can't find any way to get directly the current version of a contract document.
i iterate now over all doc versions and extract the version of each document from the display name like this:
public String getDocLastVersion(IBeanIfc bean) {
verColl = bean.getDocVersions();
verIter = verColl.iterator();
int verStart = 0;
while(verIter.hasNext()) {
verBean = verIter.next();
name = verBean.getDisplayName();
if (!name.isEmpty()) {
i = name.lastIndexOf("(");
j = name.lastIndexOf(")");
if ((i > 0) && (j > 0) && (j > i) && (j <= name.length() && (i< name.length()))) {
temp = name.substring(i + 1, j);
int verTemp = Integer.parseInt(temp);
if (verTemp > verStart) {
verStart = verTemp;
}
}
}
}
return Integer.toString(verStart);
}
i'm not happy with this solution.
if the document name is over 38 chars long there is no version stored in display name, because display name is limited to 40 chars
there must be other way to get the document version.
can somebody help me with this?
thank you
Waldemar
Request clarification before answering.
A more effective way would be to use below statement in your loop
version = verBean.getFieldMetadata("VERSION").get(bean);
You'll get the version as Integer and will be a lot more readable.
It doesn't look like the public api exposes any method for directly fetching the current (or last) version.
Some internal apis could be there but require investigation.
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.