Home > Forum > Forms > dynamic yes/no toggle( or green/red flag)

dynamic yes/no toggle( or green/red flag)
0

How do I build a yes/no toggle (or other html control with green and red colours) that, when the FullName text field is changed, the toggle changes to yes if such a FullName already exists, or stays at no if there is no FullName yet.

MVP

Hi,
you can use a Data Row type field and check the "Indicator field" option. If the query returns 2 it will be green, if 0 it will be red.

https://docs.webcon.com/docs/2023R2/Studio/Process/Attribute/DataPres/SelectField

In the "WHEN" condition (marked on the screen) you can check if a full name already exists in the database.

MVP
In reply to: Radek

Ok, this control is great.
But as in your example with SQLquery using CurrentBPSDatasase, make a reference to a database table (the same as this form is) with fullname?

If you want to check if exists the same fullname in the form of the same type, you can use bellow SQL.
xxxx is the ID of the FullName field

SELECT CASE WHEN NOT EXISTS (
SELECT 1 FROM WFElements WHERE
WFD_DTYPEID = {DTYPE_ID}
AND WFD_ID != {WFD_ID}
AND {WFCONCOL:xxxx} = '{xxxx}') THEN 2 ELSE 0 END as flag