# Can I use tags to allocate primary photo?

**URL:** <https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424>\
**Category:** RootsMagic\
**Tags:** question\
**Created:** [November 6, 2024, 10:12am UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424 "2024-11-06T10:12:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![eFFemeer](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@eFFemeer](https://community.rootsmagic.com/u/eFFemeer)\
**Post date:** [November 6, 2024, 10:12am UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/1 "2024-11-06T10:12:46Z")

</div>

I’ve imported a .ged with photos but the allocation of primary photos is lost.  
How to proceed?

---

<div class="post-metadata">

**Author:** ![kfunk](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.rootsmagic.com/kfunk/32/68_2.png) [@kfunk](https://community.rootsmagic.com/u/kfunk)\
**Post date:** [November 6, 2024, 10:50am UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/2 "2024-11-06T10:50:58Z")

</div>

GED files don’t have photos. At best they maintain whatever link the program had that exported the GEDCOM file. Your only real option is to check and see if the data is coming from a program that RM can directly import from and do a transfer that way. If not, you next option is to manually re-attach all photos.

---

<div class="post-metadata">

**Author:** ![eFFemeer](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@eFFemeer](https://community.rootsmagic.com/u/eFFemeer)\
**Post date:** [November 6, 2024, 11:03am UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/3 "2024-11-06T11:03:08Z")

</div>

Thank you for your reaction. Problem solved by chatGPT

I used SQLITE to edit my file.

UPDATE MediaLinkTable  
SET IsPrimary = 1  
WHERE IsPrimary = 0;

---

<div class="post-metadata">

**Author:** ![kfunk](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.rootsmagic.com/kfunk/32/68_2.png) [@kfunk](https://community.rootsmagic.com/u/kfunk)\
**Post date:** [November 6, 2024, 12:36pm UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/4 "2024-11-06T12:36:56Z")

</div>

No, RM does not import directly from Aldfaer.

I am not familiar with Aldfaer or how it links images. There maybe some SQLite options to do this if you are familiar with SQL.

---

<div class="post-metadata">

**Author:** ![eFFemeer](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@eFFemeer](https://community.rootsmagic.com/u/eFFemeer)\
**Post date:** [November 6, 2024, 12:48pm UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/5 "2024-11-06T12:48:57Z")

</div>

Done. SQLite worked fine.

---

<div class="post-metadata">

**Author:** ![thejerrybryan](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.rootsmagic.com/thejerrybryan/32/404_2.png) [@thejerrybryan](https://community.rootsmagic.com/u/thejerrybryan)\
**Post date:** [November 6, 2024, 3:39pm UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/6 "2024-11-06T15:39:29Z")

</div>

> [@eFFemeer](#):
>
> UPDATE MediaLinkTable  
> SET IsPrimary = 1  
> WHERE IsPrimary = 0;

It’s probably a non-issue for your use case, but when there is more then one media file associated with a person or with any other item in RM such as a fact, only one of them should be marked as primary. When you mark files as Primary or not Primary with the RM user interface, then RM enforces this convention. In other words, if you turn on Primary for one media file, then RM turns off Primary for any other files associated with the same item. When you mark files as Primary or not Primary with SQLite, this convention is not enforced unless your SQLite script enforces it.

As I mentioned, in your use case it’s likely there is only one Primary photo per person or other item. And even if there is more than one, I doubt that any actual harm will come to your RM database. Nevertheless, you might want to run the following script to see if you have any cases where more than one media file is marked as primary for the same person or other item in your RM database. This will not correct any problems. It will just find them.

```auto
SELECT COUNT(*) AS ccc, ML.LinkID, ML.MediaID, ML.OwnerType, ML.OwnerID, ML.IsPrimary
FROM MediaLinkTable AS ML
WHERE ML.IsPrimary = 1
GROUP BY ML.MediaID, ML.OwnerType, ML.OwnerID, ML.IsPrimary
HAVING ccc != 1

```

I suspect that if you run this query, there will be no hits. There would only be hits if you linked more then one media file to the same person or other item and then ran your chatGPT authored script.

I didn’t restrict my little test script just to media attached to the Person. The script will identify multiple Primary media files to any item in your database. Those with OwnerType=0 are associated with a person and those with OwnerType = some other value are associated with something else such as a fact or a citation.

---

<div class="post-metadata">

**Author:** ![eFFemeer](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@eFFemeer](https://community.rootsmagic.com/u/eFFemeer)\
**Post date:** [November 6, 2024, 4:03pm UTC](https://community.rootsmagic.com/t/can-i-use-tags-to-allocate-primary-photo/12424/7 "2024-11-06T16:03:40Z")

</div>

Thank you. I joined only one picture per person, so everything went fine.
