Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Please Help me! att & csv matching Lisp

Ganesha_Durga
Participant
Participant

Please Help me! att & csv matching Lisp

Ganesha_Durga
Participant
Participant

admire your ability and need your help.

First and foremost, please understand that my English skills are not proficient.

 

Some modifications are necessary in the CSV LISP program that you have created.

 

The structure is that when the value of "TAG-ID" in the attribute block matches the value in the CSV file, the remaining values of "HP", "VOLTAGE", and "PHASE" are updated.

 

What I want to do is to update the values of "HP", "VOLTAGE", and "PHASE" only when both "TAG-ID1" and "TAG-ID2" match.

 

Please Help me Sir!

0 Likes
Reply
Accepted solutions (2)
501 Views
6 Replies
Replies (6)

paullimapa
Mentor
Mentor
Accepted solution

I just changed one line in the code...

From this:

(setq CSVMatch (mapcar 'cdr (mapcar (lambda (pair) (if (member (car pair) tagID) pair)) data)))

To this:

(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (member (car pair) (car tagID)) pair)) data))))))

seems to work after that.

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

Ganesha_Durga
Participant
Participant

Thank you sir!!! Very AWESOME

0 Likes

Ganesha_Durga
Participant
Participant

Thank you sir!!! Very AWESOME

0 Likes

paullimapa
Mentor
Mentor

you're very welcome...cheers!!!


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes

Ganesha_Durga
Participant
Participant

There was a misunderstanding regarding my request.

 

The method I wanted to implement was that the function would only work when both "TAG-ID1" and "TAG-ID2" attribute values are met. However, the method you have "HP", "VOLTAGE", "PHASE" changes when only one of the two is met.

 

Please let me know the solution.

0 Likes

paullimapa
Mentor
Mentor
Accepted solution

O yes, I forgot about that.

Ok, replace the following lines of code:

			(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (member (car pair) (car tagID)) pair)) data))))))
		        (foreach itm (mapcar 'cons '("HP" "VOLTAGE" "PHASE") CSVMatch)
		          (if (setq f (assoc (Car itm) attv))
			    	(vla-put-textstring (caddr f) (cdr itm))))

With these lines:

			(setq CSVMatch (cdr(car(vl-remove-if 'null (mapcar 'cdr (mapcar '(lambda (pair) (if (and(member (car pair) (car tagID))(member (cadr pair) (cadr tagID))) pair)) data))))))         
       (if CSVMatch
		        (foreach itm (mapcar 'cons '("HP" "VOLTAGE" "PHASE") CSVMatch)
		          (if (setq f (assoc (Car itm) attv))
			    	(vla-put-textstring (caddr f) (cdr itm))))
       )

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos