Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] email validation

Hi!!!
I have a problem 0683p000009MPcz.png
i want to validate email address before it get saved in database..seem to be easy but couldn implement..can anyone help??
thank you
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi
On the output table, add a new field, let's call it isValid, boolean type, set the expression as:
(row22.emailaddress!=null) ? routines.CollectionUtils.isEmailValid(row22.emailaddress) : false
link the tMap to another tMap component, split the flow to two output tables, one for valid rows and another for invalid rows, add a filter expression on both of output tables,
for valid rows:
row23.isValid==true
for invalid rows:
row23.isValid==false
Best regards
Shong

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hi
What is your validate rules? Would you like to reject the record and don't insert it into database if the email address is invalid?
Best regards
Shong
Anonymous
Not applicable
Author

Hi shong!!
yes, if the email address is not valid,it should be rejected and should not process it further..
my job has a fileinputdelimited--tmap--tschemacheck--the main job.
the email should be rejected before the main job if it is invalid.
Thanks in advance.
Anonymous
Not applicable
Author

Shong!
I did create a routine function and tried to use it..
code is,
public static boolean isEmailValid(String email) {

boolean b = Pattern.matches("^+@+\\.+$", email);

return b;
}
and in tmap i added the check in emailaddress column..
(row22.emailaddress!=null) ? routines.CollectionUtils.isEmailValid(row22.emailaddress) : null
but since my emailaddress column is string and the routine code is in boolean it doesnt seem to work..
can u tell me where am missing???
Thanks a lot
Anonymous
Not applicable
Author

Hi
On the output table, add a new field, let's call it isValid, boolean type, set the expression as:
(row22.emailaddress!=null) ? routines.CollectionUtils.isEmailValid(row22.emailaddress) : false
link the tMap to another tMap component, split the flow to two output tables, one for valid rows and another for invalid rows, add a filter expression on both of output tables,
for valid rows:
row23.isValid==true
for invalid rows:
row23.isValid==false
Best regards
Shong
Anonymous
Not applicable
Author

Hi shong!!
Thanks a lot for the reply..it works!!!
I have one more serious issue unable to think a solution..
i want to populate two tables..
for instance,
emp table--> id name

1 ann
2 julie

details table --> id name detail
1 -- --
2 -- --
i want to create the rows in emp table, later need to take id of emp table and populate the same in details table.
not sure how to implement it..can do with the existing ids.but not with the one that is getting created instantly..
can u help me out in this?

Thank you!!
Anonymous
Not applicable
Author

Hi
Glad to hear that you get it works now! But, please report a new topic for new question for better management. 0683p000009MA9p.png
Best regards
Shong