Remove certain URL from records
Hello, Zotero community.
For a specific case of a research we are conducting, we are using a CSL that I have custom created for this task. In general, we need the citation to include the URL, but in certain cases (when they are from a certain publication) we don't want the URL to appear, but rather the call number.
I don't know if it is possible to include in the CSL code some instruction that includes “if ‘source’ = (whatever, the catalogues I need to exclude)”, then do not include the URL. So far, the CSL editor I work with only talks about whether the source variable appears or not or if it is a number, but it does not allow me to add any instruction about the specific text that I would want to include so that it excludes certain records. I've also tried to look for a solution in Zutilo's options, without success.
Therefore, I thought that the most viable option is to simply manually select in Zotero the records whose “source” is the one I want to remove URLs from and batch edit, but I wouldn't know how to do that. I tried to modify the code included in this other question (https://www.zotero.org/support/dev/client_coding/javascript_api#batch_editing) but this is a new world to me. Can anyone think of a solution, either from CSL editing, through Zutilo or any other tool, or from some JavaScript instruction?
Thanks in advance
For a specific case of a research we are conducting, we are using a CSL that I have custom created for this task. In general, we need the citation to include the URL, but in certain cases (when they are from a certain publication) we don't want the URL to appear, but rather the call number.
I don't know if it is possible to include in the CSL code some instruction that includes “if ‘source’ = (whatever, the catalogues I need to exclude)”, then do not include the URL. So far, the CSL editor I work with only talks about whether the source variable appears or not or if it is a number, but it does not allow me to add any instruction about the specific text that I would want to include so that it excludes certain records. I've also tried to look for a solution in Zutilo's options, without success.
Therefore, I thought that the most viable option is to simply manually select in Zotero the records whose “source” is the one I want to remove URLs from and batch edit, but I wouldn't know how to do that. I tried to modify the code included in this other question (https://www.zotero.org/support/dev/client_coding/javascript_api#batch_editing) but this is a new world to me. Can anyone think of a solution, either from CSL editing, through Zutilo or any other tool, or from some JavaScript instruction?
Thanks in advance
The first javascript example should be easy to adapt. So if you don't want any items with a brookings.edu URL, for example, you'd change the first three lines to
var fieldName = "url";
var oldValue = "brookings.edu";
var newValue = "";
and then the 7th one to
s.addCondition(fieldName, 'contains', oldValue);
obviously make sure to back-up your database before running this, but should work fine.