Options

New field on list form

JedrzejTJedrzejT Member Posts: 267
Hello

I have 2 flowfields type (EXISTS) - boolean
FldExist1,FldExist2

On form I want to show only one field
I add textbox to tablebox and set SourceExpr = NewField (Variable)

IF FldExist1 Or FldExists2 Then
NewField:=TRUE
ELSE
NewField:=FALSE


Whats the best option for it ?

Form is list type form, FldExist1,FldExist2 is not visible.

Thanks

Comments

  • Options
    JedrzejTJedrzejT Member Posts: 267
    Tempoary, I put this code in OnAfterGetRecord but this is the worst soluton I think . Variable Trans = form.sourcetable ](*,)

    Trans.GET("No.");
    Trans.CALCFIELDS("Sem In departure","Tractor In departure");

    IF (Trans."Sem In departure"=TRUE) OR (Trans."Tractor In departure"=TRUE) THEN
    InDeparture:=TRUE
    ELSE
    InDeparture:=FALSE;

    CurrForm.UPDATECONTROLS;
  • Options
    DenSterDenSter Member Posts: 8,304
    Create a function called "NewField" in the table, with a boolean return value. Inside the function, you program your thing, and RETURN the boolean value.

    Then, on your list form, you just add a textbox to the listbox, and in its SourceExpr, you enter MyTable.NewField.
  • Options
    JedrzejTJedrzejT Member Posts: 267
    Thanks

    That is more elegant code.
  • Options
    Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    You can do this without code

    Just put in the SourceExpr

    (FldExist1) Or (FldExists2)

    You can always put one line of code in the SourceExpr.

    This works.
  • Options
    DenSterDenSter Member Posts: 8,304
    Right, which is the same without having it available on another form. For consistency and maintenance reasons I prefer to put it in the table. If you have more than one list form for that table, they would both be updated when you change the code in the table.
Sign In or Register to comment.