Hi Diana,
It would be useful to know the reason UpdateView is called. If a property of interest has changed, I could process its value. I examined context.updatedProperties, however it did not contain any of the bound properties after updating values in the harness. The only thing that showed up was a property called "layout".
I'll try to provide more context on my use case.
I have a Canvas app containing my custom control, a variable ‘varInputValue’ bound to the control’s ‘inputValue’ property, a textbox ‘inputValueBox’ and a button with an action Set(varInputValue, inputValueBox.text).
Whenever the user clicks the button, the string in the textbox is passed as input to my custom control. I process the user input with a 3rd party library inside the control:
public updateView(context: ComponentFramework.Context<IInputs>): void {
let inputValue = context.parameters.inputValue.raw; // the value of the parameter is persisted between UpdateViews. I do not want to process the same value every time UpdateView is called, unless a new input comes from the user(the new input can be the same string as the old input), obtained through a Set Action.
if (!this.isNOUOE(inputValue) && inputValue !== 'val'){
this._inputValue = inputValue;
// Process inputValue with a 3rd party library
this._notifyOutputChanged();
}
}
public getOutputs(): IOutputs {
return {
inputValue: this._inputValue
};
}
If I could reset the 'inputValue' property to empty string after running UpdateView , I can be sure that input values that are not empty strings are new user inputs.
Maybe there is a way to do this using Power Apps code. I tried resetting the property in the same formula, using consecutive actions:
Set(varInputValue,"Testing this input");
Set(varInputValue,"");
The framework executes only the last action.
Thanks for your help.