When using the Browse Variables button in the Copy Data App, I can select a variable, but when clicking OK, the result is not copied in the expression field. Is that a small bug in the app or am I doing something wrong?
Furthermore, the documentation (https://www.photools.com/dev-center/doc/imatch/IMatch.html (https://www.photools.com/dev-center/doc/imatch/IMatch.html)) states varBrowser being a Promise:
varBrowser(params) → {Promise})
Shouldn't the code then be something like:
IMatch.varBrowser(0).then(function(r) {...
Finally, the example in the documentation uses the statement:
var res = IMatch.browseVariables(100);
Code in the Copy Data App:
$('#btn-browser').click(function(e) {
var result = IMatch.varBrowser(0); // We use the selected file as the template file
if (result.result == 'ok') {
$('#expression').val($('#expression').val() + result.var);
saveData();
}
e.preventDefault();
return false;
});
});
Ger
Thanks. Fixed for the next release. Old version shipped :-[
Correct is:
$('#btn-browser').click(function(e) {
IMatch.varBrowser(0).then(function(response) {
if (response.result == 'ok') {
$('#expression').val($('#expression').val() + response.var);
saveData();
}
});
e.preventDefault();
return false;
});
Thanks, Mario, just wanted to post my working version.
$('#btn-browser').click(function (e) {
IMatch.varBrowser({
samplefile: 0
}).then(function (r) {
if (r.result == 'ok') {
$('#expression').val($('#expression').val() + r.var);
saveData();
}
});
e.preventDefault();
return false;
});
Ger