| 
			
			 | 
		#1 | 
| 
			
			
			
			 Junior Member 
			
			![]() Posts: 5 
				Karma: 10 
				Join Date: Jun 2011 
				Location: Brooklyn, NY 
				
				
				Device: Nook Color, Kindle 3G 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Bogus error in save template from custom column
			 
			
			
			I have a Samsung Galaxy Note 10.1 (2014) that I'm trying to get files onto. I've defined a couple of custom columns pretty much out of the help pages on the calibre web site 
		
	
		
		
		
		
		
		
		
		
		
		
	
	series_stripped: {series:re(^(A|The|An)\s+,)||} series_initials: {#stripped_series:re(([^\s])[^\s]+(\s|$),\1)} But when I attempt to "Configure this device" for and use #series_initials in the template, I get an exception {series:'ifempty($,field('author'))'||/}{#series_initials:|| }{title} EXCEPTION: Value: unknown field #series_initials I finally just saved it anyway. It worked. Calibre 1.32, Fedora 20, x86-64  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			@kovid: the problem is that the MTP driver does not pass field metadata to the template editor dialog, so the editor has no idea what custom columns exist. I don't know if it can get the field metadata at that point in its life cycle.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | 
| 
			
			
			
			 creator of calibre 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609 
				Karma: 28549044 
				Join Date: Oct 2006 
				Location: Mumbai, India 
				
				
				Device: Various 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			You should certainly be able to get field metadata for the current library with get_gui().current_db.new_api.field_metadata 
		
	
		
		
		
		
		
		
		
		
		
		
	
	However, since the template setting is not per library, perhaps the proper fix is to no validate field names at all? I dont know if that's possible with validation_formatter however.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			The problem isn't the validation formatter. It already indicates that any desired field exists.  
		
	
		
		
		
		
		
		
		
		
		
		
	
	The template editor uses the normal formatter so that it can show sample values for the template when editing composite column templates. Perhaps when it is in a no-book context it should use the validation formatter and not attempt show any sample values. That would be relatively easy to do.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,525 
				Karma: 8065948 
				Join Date: Jan 2010 
				Location: Notts, England 
				
				
				Device: Kobo Libra 2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Pushed a fix that grabs a copy of field metadata. Turned out not to be feasible to use the validation formatter because it doesn't parse general program mode templates. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	This should be OK even in a non per-library context. If the user enters a custom column lookup key then it should be in the current library so that the template can be tested.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
![]()  | 
            
        
    
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Custom Column with sub-folder template | Tanjamuse | Library Management | 6 | 01-13-2014 01:22 AM | 
| Template for custom column | BeeTee-Ess | Library Management | 5 | 10-04-2013 09:55 PM | 
| [Custom Column - Composite] Template Help Requested | Ealdwulf | Library Management | 2 | 06-16-2012 05:58 AM | 
| Help with template for custom column from tags | africalass | Library Management | 2 | 07-16-2011 12:47 PM | 
| Using Custom Metadata in Save Template | EJvdH | Calibre | 1 | 07-02-2010 07:06 AM |