# How to get all data from the Persistency file?

**URL:** <https://swi-prolog.discourse.group/t/how-to-get-all-data-from-the-persistency-file/3673>\
**Category:** Help!\
**Created:** [March 2, 2021, 11:54am UTC](https://swi-prolog.discourse.group/t/how-to-get-all-data-from-the-persistency-file/3673 "2021-03-02T11:54:17Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [March 2, 2021, 1:01pm UTC](https://swi-prolog.discourse.group/t/how-to-get-all-data-from-the-persistency-file/3673/2 "2021-03-02T13:01:34Z")

</div>

Quick guess here; did not try any of this.

Once a persistency file is loaded, the data (facts in this case) should be accessible as expected and I take it that is what you are doing based on the question.

This should work.

```prolog
bagof(user_data(Id,Email,Password,Role),user_data(Id,Email,Password,Role),Users).

```

Now all of the facts are in the variable `Users` as a list.

See: [Finding all Solutions to a Goal](https://www.swi-prolog.org/pldoc/man?section=allsolutions)

HTH

* * *

**EDIT**

I have created a few topics on this site that talk about and demonstrate using [library(persistency)](https://www.swi-prolog.org/pldoc/man?section=persistency), the most complete and accurate example code can be found in this [post](https://swi-prolog.discourse.group/t/wiki-discussion-generating-cytoscape-js-graphs-with-swi-prolog/2816/4).

---

_[View the full topic](https://swi-prolog.discourse.group/t/how-to-get-all-data-from-the-persistency-file/3673)._
