V18 Project Conversion: Radio Buttons

When converting a structure to project mode, one of the warnings in the log is:

Compatibility setting ‘Radio buttons grouped by name’ switched off.

Is there any way to use Find in Project to find radio buttons? Other items like invisible buttons are called out individually in the log, but not individual ungrouped radio buttons. I’d really rather not have to look at every page of every form to find them all.

You could do it using code.

ARRAY TEXT($forms;0)
FORM GET NAMES($forms)
For ($i;1;Size of array($forms))
	$form:=FORM Convert to dynamic($forms{$i})
	For each ($page;$form.pages)
		If ($page#Null)
			ARRAY TEXT($objects;0)
			OB GET PROPERTY NAMES($page.objects;$objects)
			For ($j;1;Size of array($objects))
				If ($page.objects[$objects{$j}].type="radio")
					  //found - output $form{$i} & $objects{$j} to log
				End if 
			End for 
		End if 
	End for each 
End for 

That just does project forms, so do the same for each table in your database.

For ($table;1;Get last table number)
	If (Is table number valid($table))
		ARRAY TEXT($forms;0)
		FORM GET NAMES(Table($table)->;$forms)
		For ($i;1;Size of array($forms))
			$form:=FORM Convert to dynamic(Table($table)->;$forms{$i})
			For each ($page;$form.pages)
				If ($page#Null)
					ARRAY TEXT($objects;0)
					OB GET PROPERTY NAMES($page.objects;$objects)
					For ($j;1;Size of array($objects))
						If ($page.objects[$objects{$j}].type="radio")
							  //found - log Table name($table), $form{$i} & $objects{$j}
						End if 
					End for 
				End if 
			End for each 
		End for 
	End if 
End for 
2 Likes

Thanks! I was thinking about whether I should explore trying to process forms via code, this looks much simpler than I thought it would be.

No worries. I’ve got the same issue that I’ll need to deal with before converting to project mode (225 radio buttons - not too bad).

If you wanted you could probably use code to fix them up after you have converted to project mode.

  • Open each form json
  • Identify groups of radio buttons based on 1st character of variable name
  • Add a group to $form.editor.groups e.g { "MyGroup": ["RadioButton1","RadioButton2"]}
  • Add a radioGroup property to each of the radio buttons e.g. "radioGroup": "MyGroup"
  • Save the job file

Bit of trouble, but could be worth it if you’ve got heaps of radio buttons.

Hi,

In project, the notion of group for the radioButton and the notion of groups to manipulate in the editor have been separated.

So you only need to add the “radioGroup” property with a name.

It is not mandatory or necessary to create an “editor group” property.

Thanks.
Vanessa.

3 Likes

That is great news. Having to remember to regroup the radio buttons after editing a script was always going to be a problem for me. I’ll move this down to “things to do after converting to project mode for the last itme”.

Thanks for the tip Vanessa. That makes it even easier :smiley: