I 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!
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Solved by paullimapa. Go to 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.
you're very welcome...cheers!!!
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.
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))))
)
Can't find what you're looking for? Ask the community or share your knowledge.