As the custom calculation script of G4 use this code:
var v = Number(this.getField("Text1").value);
if (v>0) event.value = v;
else event.value = 0;
You need to make sure that the G4 field is located lower in the field calculation order list than Text1 for it to work correctly.
Thank you, I will test this out!