Hello,
I have a simple PCF that accept 2 strings and return 2 strings modified by MathJS library.
In dev mod, PCF works like a charm but return nothing in Dev. Any idea? I bet a coin on "usage".
With simple usage : textbox, result in label is OK
with complex usage : variable inside the input = does not refresh
ManifestTypes.d.ts
/*
*This is auto generated from the ControlManifest.Input.xml file
*/
// Define IInputs and IOutputs Type. They should match with ControlManifest.
export interface IInputs {
stringToEvaluate: ComponentFramework.PropertyTypes.StringProperty;
arrayToEvaluate: ComponentFramework.PropertyTypes.StringProperty;
calculation: ComponentFramework.PropertyTypes.StringProperty;
calculationArray: ComponentFramework.PropertyTypes.StringProperty;
}
export interface IOutputs {
calculation?: string;
calculationArray?: string;
}
ControlManifest.Input.xml
<property name="stringToEvaluate" display-name-key="String to be Evaluated" description-key="myString" of-type="SingleLine.Text" usage="input" required="true" default-value="3+4" />
<property name="arrayToEvaluate" display-name-key="Array to be Evaluated" description-key="myString" of-type="SingleLine.Text" usage="input" required="true" default-value="3+4" />
<property name="calculation" display-name-key="Calculation result" description-key="myString" of-type="SingleLine.Text" usage="bound" required="true" />
<property name="calculationArray" display-name-key="CalculationArray result" description-key="myString" of-type="SingleLine.Text" usage="bound" required="true" />
Index.ts
public updateView(context: ComponentFramework.Context<IInputs>): void
{
// Add code to update control view
this._notifyOutputChanged();
const math = create(all)
const _vExpression=this._context.parameters.stringToEvaluate.raw
const _vExpressionArray=this._context.parameters.arrayToEvaluate.raw
const ans = math.evaluate(_vExpression as string)
this._expression=math.format(ans)
if (_vExpressionArray !== null) {
const ans2 = math.evaluate(Array( JSON.parse(_vExpressionArray)));
this._expressionArray=math.format(ans2) // okay, myString is guaranteed to be a string
console.log(ans2)
}
}
/**
* It is called by the framework prior to a control receiving new data.
* @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output”
*/
public getOutputs(): IOutputs
{
return {
calculation:this._expression,
calculationArray:this._expressionArray
}as IOutputs;
}
WarrenBelz
109
Most Valuable Professional
Michael E. Gernaey
82
Super User 2025 Season 1
MS.Ragavendar
72