0

The requirement is to store the hardcoded value for varchar which is in an entity file(.eti). I tried adding to the default option but it is not reflecting.

2 Answers2

3

Default option works well with boolean values (true/false), typelists (you can choose a default typecode), monetary amounts too, but it looks like it is not allowed to specify a default varchar. Therefore the easiest way would be to create a preupdate rule which inserts that default value every time when you create a new record in the database.

Preupdate rule example:

  @gw.rules.RuleName("YourEntityAssignDefaultValue")
internal class YourEntityAssignDefaultValueRule {
  static function doCondition(yourEntity : entity.YourEntity) : boolean {
    return yourEntity.New
  }

  static function doAction(yourEntity : entity.YourEntity, actions : gw.rules.Action) {
    yourEntity.yourColumn = "defaultValue"
  }
}
SebastianJ
  • 95
  • 1
  • 10
1

you can achieve through getter and setter properties in an appropriate enhancement class.

  public property get PolicyNumber(): String {
      return  this.PolicyNumber  }

and somewhere class you must be assigned the value to the PolicyNumber field then it will reflect.

Py-Coder
  • 2,024
  • 1
  • 22
  • 28
  • @Harshu ganesh Just remember that this solution not grants you value in database, make sure that you don't need it. (for example for db reports purpose) – kajojeq Dec 06 '19 at 09:30