facts handling question

Discussions related to Visual Prolog
David Snook
VIP Member
Posts: 79
Joined: 6 Feb 2003 0:01

facts handling question

Unread post by David Snook » 3 Jan 2013 0:48

This is a programming question that I'm curious about:

In the now ancient VP5.2 version one could use a neat little trick to save individual fact terms in an external database. In my case I saved user preferences as strings in MS SQL.

For example: (excuse the use of VP5.2 code here)

facts - report_preferences
determ pref1(_,_,_,_,_,_).
determ pref2(_,_,_,_,_,_,_,_,_).
determ pref16(_,_,_,_,_,_,_).

%Save user preferences code segment

Code: Select all

  save_preferences:-                  retract(DATA,report_preferences),                  term_str(report_preferences,DATA,DATASTR), %convert term to string                  insert_rpt_prefs(CID,USERID,DATASTR), %save term in SQL                  fail.             save_preferences.
In more recent versions of VP it doesn't seem possible to handle fact terms in this way. It's certainly not a problem to check and retract each term separately but, out of curiosity, just thought I would ask in case this nice little method can still be achieved?


David Snook

Post Reply