Use the find/find-all match method to find the list element. find-allmatch
Find a sublist in the list
Assume that the database contains several rows of records. The returned results of the newlisp mysql module use a list to indicate these rows of records. Each element is a list containing a row of records, each record list contains several lists. Each list has two elements: field name and field value.
Now we can use the find Method for Pattern Search.
> (find (list (list "issue_id" 1773) '*) '((("issue_id" 1773) ("custom_field_id" 7) ("type" "IssueCustomField") ("name" "\229\143\145\231\142\1\76\230\151\165\230\156\159") ("default_value" "") ("value" "2014-06-27"))) match) 0
In this example, the first field in these rows is issued_id and the value is 1773. Because find is used, the first row is searched.
Find returns 0. You can view the result with $0.
> $0 ("issue_id" 1773) ("custom_field_id" 7) ("type" "IssueCustomField") ("name" "" ") (" default_value """) ("value" "2014-06-27 "))
Find several sub-lists in the list
You can use find-all to find all records that match the pattern,
(set 'r (find-all (list (list "issue_id" issue-id) '*) issue-customized-values))
Similar to find, but note that the result is returned directly. Therefore, do not use $0 to view the result.
However, you can view the number of records found in $ count.
Find/find-all match is particularly suitable for further searching the database result record set.