# Calling table/1 during runtime

**URL:** <https://swi-prolog.discourse.group/t/calling-table-1-during-runtime/1037>\
**Category:** Help!\
**Created:** [August 5, 2019, 6:57pm UTC](https://swi-prolog.discourse.group/t/calling-table-1-during-runtime/1037 "2019-08-05T18:57:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dehydrate](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/dehydrate/32/429_2.png) [@dehydrate](https://swi-prolog.discourse.group/u/dehydrate)\
**Post date:** [August 5, 2019, 6:57pm UTC](https://swi-prolog.discourse.group/t/calling-table-1-during-runtime/1037/1 "2019-08-05T18:57:08Z")

</div>

I’m using: SWI-Prolog version 8.0.3 and have also tried running the code in SWISH.

I want the code to: I want to call table/1 during runtime. The tabling documentation says this is possible.

But what I’m getting is: From version 8.0.3, the error I’m getting is

**ERROR: Wrong context: (table)/1 can only be used in a directive**

I’m assuming from this that in 8.0.3 table/1 can only be used as a directive.

In SWISH,

**No permission to call sandboxed `assert(\_1336)'**  
**Reachable from:**  
\*\* assert\_and\_table(A)\*\*

My code looks like this:

```prolog
assert_and_table(P) :-
    assert(P),
    table(P).

```

I’m not very familiar with SWISH, and I just tried running the code to a SWISH notebook to see if calling table/1 during runtime was only possible in later versions. From the error it seems the problem is just that I don’t know how to use SWISH. Any suggestions appreciated.

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 5, 2019, 7:13pm UTC](https://swi-prolog.discourse.group/t/calling-table-1-during-runtime/1037/2 "2019-08-05T19:13:49Z")

</div>

This might be a little confusing 🙂

- The online manual runs the development version (8.1.x)
- Runtime table/1 is only available in the development version
- SWISH does not allow things that might compromise other users or the system. A call `assert(P)` can do anything as it doesn’t know what P is.That is why you get a permission error.

All current development is on tabling and thus if you want to explore tabling, please use the development versions. The non-tabling part is better and more stable than 8.0.3. Tabling is much better, but as it is under very active development it can be a unstable.

---

<div class="post-metadata">

**Author:** ![dehydrate](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/dehydrate/32/429_2.png) [@dehydrate](https://swi-prolog.discourse.group/u/dehydrate)\
**Post date:** [August 5, 2019, 7:25pm UTC](https://swi-prolog.discourse.group/t/calling-table-1-during-runtime/1037/3 "2019-08-05T19:25:31Z")

</div>

Thanks, Jan. I had a feeling it was related to the development version. I’ll look into that.
