Find list elements with Find/find-all match method

Source: Internet
Author: User

Find a sub list in list

Assuming that there are several rows of records in the database, the newLISP MySQL module returns the result is a list representing this number of rows of records, and then each element is a list, which contains a row of records, each row of records list contains a number of lists, Each list has two elements: a field name and a field value.

Now we can use the Find method to find patterns.

> (List (List "issue_id" 1773) ' (("issue_id" 1773) ("custom_field_id" 7) ("Type" "Issuecustomfield") ("name" "\229\143\145\231\142\176\230\151\165\230\156\159") ("Default_value" "" ") (" Value "" 2014-06-27 "))) match) 0

This example is to find the first row in the row named issued_id, with a value of 1773, because it uses find, so look for the first row.

Find returns 0, with $ A to view the results.

> ("issue_id" ("1773") ("custom_field_id" 7) ("Type" "Issuecustomfield") ("name" "Discovery Date") ("Default_value" "") ("value") "2014-06-27"))

Find several sub-lists in list

Use Find-all to find all records that match the pattern,

(Set ' R (Find-all (list "issue_id" Issue-id) issue-customized-values))

Similar to find, just notice that the results are returned directly. So don't look at the results with $ A.

However, $count can see how many records were found.


Find/find-all match is ideal for further lookups of database result recordsets

Find list elements with Find/find-all match method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.