Change bottonInset on a subform

marcink-lwR9iu

12-09-2018

Hi

I'm having difficulties on changing SubformB.margin.bottomInset.

On SubformB::calculate I have this script:

if(this.SubformA.instanceManager.count == 1){

  this.margin.bottomInset = "3.2mm";

}

else{

  this.margin.bottomInset = "0mm";

}

console.println("** bottom: " + this.margin.bottomInset);

While I can see the println, with the correct values, the bottom margin doesn't change visually.

Any help on this?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

_Bruce_Robertson

MVP

12-09-2018

Should be as simple as that, your form would have to be dynamic and your subform in a flowed container, but I assume it is if you are playing with the instanceManager.

Can you share your form?

Answers (1)

Answers (1)

radzmar

MVP

15-09-2018

You'll have to force the calculate script to execute to see the desired effect.

Given you have a subform "SF" with a nested subform "SubformA" in it. You'll need two things:

A) A script in the calculate event of "SF"

// Script to set instances of subform "SubformA". Replace with you own script if neccessary!

_SubformA.setInstances(this.rawValue);
// scriot to execute the calculate script of subform "SF"

SF.execCalculate();

B) A script to add/remove instances of SubformA and triggering the calculation script in "SF".

this.margin.bottomInset = this._SubformA.count === 1 ? "3.2mm" : "0mm";