whilst there isn't a way to force the a role within the htmpl. Another way which was recommended by Michael Muller was to pass the role we wanted in the URL.
http://localhost/CAisd/pdmweb.exe?OP=DISPLAY_FORM+HTMPL=set_role.htmpl+KEEP.new_role=12345
-then within the code to pick up this argument,
-check the user has access to the role
-if the role that is being requested is what it is currently set to then to rewrite the URL
- if it is a role that is not recognised to put up an alert box and logout.
This seems to work fairly well and might be useful for someone who has an obscure requirement.