Thore
1
- User can link request tickets by filling inn a request number of a existing ticket and Retool will validate if the ticket is valid or not.
Like this:
I want to validate if the Request number exist in my DB.
If Not
If it exists
I have tried using custom rule:
{{(request.value.replace(/[^0-9]/g,'') === Get_request.data.RequestID ? theme.success : theme.danger)}}
My Get_request:
SELECT REQ.RequestID
FROM Request REQ
WHERE REQ.RequestID = {{request.value.replace(/[^0-9]/g,'') }};
Is there some one that can help a new ReTool user that has no Experian with Javascript?
1 Like
hi @Thore !
how many distinct values of RequestID do you have?
if it is like 1,000 to 100,000, i would recommend this:
select id from my_table
and then your custom rule will say:
{{ myQuery.data.id.indexOf(myTextInput1) >= 0 ? "" : "red" }}
the custom rule wants empty string (or anything falsy) to be valid, instead of success color
hope this helps!
Thore
3
Hi.
This worked for me.
I have a issue when I remove information from the text field.
Start
If return red if ID dose not exist (This is what I wanted)
Then I remove it and leaving it blank (NULL)
I expected it to be as Start
Also the number of ID's I have today is >970 000
Thanks.
1 Like