You need to manipulate the default value of the toggle control, and you need to ensure that the number control gets set to the correct value when the toggle control is changed in the form.
If you work with list items in a SharePoint custom form, for example, you can
add a toggle control to the card for the SharePoint field. Let's call this "FirstToggle". Then set the default of that toggle control to a formula like
ThisItem.myIntegerField = 1
That will return TRUE or FALSE and swing the toggle.
Next, you need to write the state of the toggle back into the number control. The default value for the number control is then
If(FirstToggle.Value,1,0)
If you use a different scenario, different data source, a gallery, etc., the principle is the same: Load the default of the toggle from the value of the stored data with the formula that compares the value with 1
. Set the default of the data field by evaluating the state of the toggle.
