* Check if source is new or existing
Check if source is new or existing
In a DEA plugin I test if a Prepared Citation exists to make sure it's run as a DEA.
In addition I test the length of the fields table in the pCite Object to determine if the Source is newly created (empty source) or an existing one (if > 3).
If however CP changes the pCite Object the test may be invalidated. Is there another and more failsafe way to do this test?
In addition I test the length of the fields table in the pCite Object to determine if the Source is newly created (empty source) or an existing one (if > 3).
If however CP changes the pCite Object the test may be invalidated. Is there another and more failsafe way to do this test?
- ColeValleyGirl
- Megastar
- Posts: 2353
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Check if source is new or existing
By
do you mean them changing the architecture in the future? If so, there's no way to protect against that, but I think it unlikely to change, at least for the lifetime of V7.
Re: Check if source is new or existing
What I mean is that in object oriented programming it is good practice to use methods to access data in an object. Thereby allowing the owner (CP in this case) of the object to change/extend the internals of the object without any consequence for the users.
As it is, I am now using data inside the pCite object/table directly... hence my question (I found no function/method to determine if a source is new/empty).
As it is, I am now using data inside the pCite object/table directly... hence my question (I found no function/method to determine if a source is new/empty).
- ColeValleyGirl
- Megastar
- Posts: 2353
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Check if source is new or existing
There is no so such function unfortunately.
Re: Check if source is new or existing
Thanks Helen, unfortunately indeed.
Makes me wonder how all the DEA plugins verify that the the source/citation is a new and empty one. I would expect this to be an important check.
Makes me wonder how all the DEA plugins verify that the the source/citation is a new and empty one. I would expect this to be an important check.
- ColeValleyGirl
- Megastar
- Posts: 2353
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Check if source is new or existing
Not all DEAS require that the source is new, merely that a prepared citation exists. Some of them check for specific field values, so the last thing they need is an empty/new source.
Re: Check if source is new or existing
Agreed Helen, 'not all', but (as a retired mathematician
) that means that at least one remains. And if I'm guessing right, you as a experienced DEA developer know which one (maybe one of your own). Which brings me back to my original question... how have you (or anyone that did DEA's that needed fresh sources/citations) verified it's freshness?

- ColeValleyGirl
- Megastar
- Posts: 2353
- Joined: 28 Dec 2005 22:02
- Family Historian: V7
- Location: Cirencester, Gloucestershire
- Contact:
Re: Check if source is new or existing
At present, yours is the only DEA that needs a new source; ALL the others need an existing one.
I have one to develop that will need a new source (based on an existing plugin written by somebody else for V6) but I haven't started work on that. I can't think of a better check than your (other than exhaustively testing that all fields are empty).
I have one to develop that will need a new source (based on an existing plugin written by somebody else for V6) but I haven't started work on that. I can't think of a better check than your (other than exhaustively testing that all fields are empty).