Automatic values based on radiobutton fields

I want to fill a field automatic based on changes in a radiobutton field. My code works fine when I test it on a commandbutton, but I want it to be automatically set when the user change the radiobutton field.

Thanks to all earlier help to get this code:

TempVar1 := @Middle(@GetField(“MSGTYP”);1;1);

FIELD IntGroup := @Implode(@Name([CN];@DbLookup(“”:“NoCache”;“”:“QSYS.NSF”;“GRPVIEW”;TempVar1;“RCP”));“,”);

@Command( [RefreshWindow] )

I cannot find any possibility to use formula in the properties.

Subject: Automatic values based on radiobutton fields

Roger,

You need to put the formula in the target field (IntGroup) instead of the radio button

Change the formula to include reference to the radio button field value…

If RadioButtonField=“Yes”;@Implode(@Name([CN];@DbLookup(“”:“NoCache”;“”:“QSYS.NSF”;“GRPVIEW”;TempVar1;“RCP”));“,”)

and make sure that the radio button has “Refresh fields on keyword change”

HTH

Mike

Subject: RE: Automatic values based on radiobutton fields

Thanks for the advice but still there are problems.

I choosed to read the value from the radiobutton field and take the part I need by using:

@Middle(@GetField(“RadioButtonField”);1;1)

into a field called “MsgType” and the value is correct.

Then I try to use this value by using this code:

@If(MsgType=1;@Implode(@Name([CN];@DbLookup(“”:“NoCache”;“Server”:“QSYS.NSF”;“myview”;MsgType;“mycolumn”));“,”);“”)

and get the error:

Field: ‘IntGroup’: Entry not found in index

and the form doesn’t load.

I’ve tried several times with “MsgType”=“1” with and without apostrophes and done a lot of testing.

When I use the same code on a command button, the field IntGroup is filled by the correct value.

What have I done wrong now ?

Subject: RE: Automatic values based on radiobutton fields

Shouldn;t it be a semi-colon between “Server” and “QSYS.NSF”??

Also, is the MsgType field above the IntGroup field? Which evaluates first?

Mike

Subject: RE: Automatic values based on radiobutton fields

I found the error, and… it was a stupid one.

I didn’t see that I during my tests probably did reset the “computed” property on the field IntGroup.

Sorry, but the frustration made me blind.

Thanks for all help though.

Subject: RE: Automatic values based on radiobutton fields

There is a semicolon between server and database.

The MsgType field is above the IntGroup in the form and the first time I open the form it get the value 1. If I change the radiobutton field my MsgType field doesn’t change.

When I try to put the @Implode command in the IntGroup field as default value

Both fields are in a section which is visible for a number of people and hidden for others.

If I put the code in a command button it works but if I try to use it as an automatic process it fails.

The radiobutton has automatic refresh on.

Subject: RE: Automatic values based on radiobutton fields

Is this independent of number of choises on the radiobutton ?

I have 6 now, but this can increase.

Subject: RE: Automatic values based on radiobutton fields

You would have to increase your @if statement

@if(RadioButtonValue=1;…;

@if(RadioButtonValue=2;…;

@if(RadioButtonValue=3;…;

@if(RadioButtonValue=4;…;“”)

and so on…

Mike