Page 1 of 1

Mass text substitution on fields

Posted: Fri Nov 02, 2018 11:41 pm
by randian
For example, edit the url field of all selected items and replace
http://www.amazon.com
with
https://www.amazon.com

Preferably, with optional regex support for more sophisticated substitutions.

Re: Mass text substitution on fields

Posted: Sat Nov 03, 2018 3:38 pm
by Conor
Thanks for the feedback. As you probably know you can use the backend SQL for now, but pointing it out for others finding this thread.

Re: Mass text substitution on fields

Posted: Sat Nov 03, 2018 9:25 pm
by randian
Conor wrote:Thanks for the feedback. As you probably know you can use the backend SQL for now, but pointing it out for others finding this thread.
Thanks. I tried that and it worked, but PocketPedia won't sync the records whose fields were altered.

Re: Mass text substitution on fields

Posted: Mon Nov 05, 2018 5:46 am
by Conor
:oops: :shock: You are ahead of me.

Pocketpedia relies on the "date edited" to keep the sync fast.

You can swipe left and delete the collection from Pocketpedia (if you sync more than one Pedia) or delete Pocketpedia and reinstall to have the database sent brand new to Pocketpedia. Otherwise here is the SQL command to update date edited to today.

Code: Select all

update zentry set zdateedited = 563107125.271653 where zurl like "%amazon.com%";

Re: Mass text substitution on fields

Posted: Mon Nov 05, 2018 10:17 pm
by randian
I did "ZDATEEDITED = datetime('now')". Oddly, syncing PocketPedia a second time repeated itself rather than deciding there was nothing to do. Are you storing timestamps as local time rather than UTC? Or is there something wonky with PocketPedia?

Re: Mass text substitution on fields

Posted: Tue Nov 06, 2018 5:03 am
by Conor
The function "datetime" does not work, as SQL date is based of January 1st 1970, and the Mac date is based from January 1st 2001. So your 30 years behind, you could add 30 years worth of seconds (978328800).

Re: Mass text substitution on fields

Posted: Tue Nov 06, 2018 2:03 pm
by randian
Conor wrote:The function "datetime" does not work, as SQL date is based of January 1st 1970, and the Mac date is based from January 1st 2001. So your 30 years behind, you could add 30 years worth of seconds (978328800).
That doesn't give you the number range you're showing (563...). It's not clear how that number was generated.

Re: Mass text substitution on fields

Posted: Fri Nov 09, 2018 4:12 am
by Conor
Sorry, it would be subtract instead of add to the internal SQL date function.

I copied pasted from a forum post 563107125.271653 = 17.8560098 years. Starting from 2001, would put that at around October 2018.