tag:infinitekind.tenderapp.com,2009-01-14:/discussions/moneydance-development/7689-backward-compatabilityInfinite Kind: Discussion 2023-03-30T16:10:20Ztag:infinitekind.tenderapp.com,2009-01-14:Comment/573276722022-12-29T14:25:56Z2022-12-29T14:25:56ZBackward compatibility<div><p>Easy... Yes!</p>
<p>Ah, hang on... Is this Python or pure java?</p>
<p>If Python:<br></p>
<pre>
<code>if moneydance.getBuild() >= 4091:
print "This is the current version of MD"
print acct.getRecursiveBalance()</code>
</pre>
<p>So, Py(jy)thon is perfectly happy with this as all code is run dynamically, there is no precompile.</p>
<p>You just need to know the build numbers relevant to the methods you are calling..</p>
<p>Toolbox extension has many of these checks so it can use code relevant to that build...</p>
<p>So, for Java to resolve/compile, then I expect you will need to supply it (your IDE/compiler) with a moneydance.jar file that contains the relevant methods... I'm guessing here, but if you want a multi version setup then you might have to link all the relevant jars from relevant versions to your project so that it can resolve all the calls..... As far as I am aware you can just save your jar files as moneydance4091.jar, moneydance274.jar (etc) and just link them all into the IDE (even if you don't include them in the final extension package)...</p>
<p>As for your other question:<br>
- I hard code a check for a minimum build of 1904 (which is MD2019.4). Why, well there was a major change to CurrencyType / Securities before then and also changes to the internal structure(s) of MD... Just too complicated to worry about.. If you are using the official API moneydance dev jar to link/compile then everything in there (except one thing) should work / compile... If you are going off piste and using unpublished methods, then you need to know which were added/changed since the API jar was compiled.. Thus 2019.4(1904) is a reasonable cutoff..</p>
<p>NOTE: when using java to get back to the right Main version of context you need to cast as follows:<br></p>
<pre>
<code>com.moneydance.apps.md.controller.Main mdContext = (com.moneydance.apps.md.controller.Main) context;</code>
</pre>
<p>Let me know how this goes?</p>
<p>Any more questions, shout..?</p></div>Stuart Beesley (Mr Toolbox)tag:infinitekind.tenderapp.com,2009-01-14:Comment/573276722022-12-29T16:09:49Z2022-12-29T16:09:49ZBackward compatibility<div><p>You need to be careful. How far do you want to go back? The underlying<br>
data model of MD changed between versions 2015 and 2017 of MD so you<br>
have different versions of your extension. With 2017/2020/2021/2022 the<br>
data model is the same. Sean introduced the SyncRecord way of<br>
controlling updates in MD 2017.</p>
<p>Also be careful of which version of java you use to compile. TIK has<br>
been changing the java version and if you compile with a newer version<br>
of java than your target version then you might run into problems.</p>
<p>If you are writing Java then the .mxt file will have a meta_info.dict<br>
file which has the minbuild parameter ( "minbuild" = "1820"). 1820<br>
happens to be the one of the earlier builds of MD 2020. MD will not<br>
load your extension if the minbuild parameter is greater than the build<br>
of MD.</p>
<p>Lastly, if you look at<br>
<a href="https://infinitekind.com/previous-versions-of-moneydance">https://infinitekind.com/previous-versions-of-moneydance</a> you can get the<br>
final build number for each version of MD. Just click on the version and<br>
the build number is shown, eg. MD 2017 is build 1706.<br>
Regards<br>
Mike</p></div>Mike Bray (Quote Loader Author)