It is never a distraction. There is so few places to learn about using Valentina with Livecode.<br><br><div class="gmail_quote">On Mon, Mar 26, 2012 at 7:10 PM, Barry G. Sumpter <span dir="ltr"><<a href="mailto:barrysum@bigpond.net.au">barrysum@bigpond.net.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">LOL.<br>
Every time I post I find a solution in 5 mins afterwards.<br>
<br>
The very next example in the Field Find allow us to nominate a dataset<br>
(set1) to perform the Find Field on.<br>
<br>
put VField_FindValue( fld_string, "aa", set1 ) into res<br>
<br>
Apologies, for the distraction.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
-----Original Message-----<br>
From: Barry G. Sumpter [mailto:<a href="mailto:barrysum@bigpond.net.au">barrysum@bigpond.net.au</a>]<br>
Sent: Tuesday, 27 March 2012 9:33 AM<br>
To: '<a href="mailto:valentina@lists.macserve.net">valentina@lists.macserve.net</a>'<br>
Subject: Please help with API way of checking UserID and Password<br>
<br>
Hi all,<br>
<br>
I'm not sure if this is the correct way to verify UserID and Passoword using<br>
API.<br>
This is the only example I could find with two fields.<br>
I'm used to the SQL way so the API way is a little strange to me.<br>
<br>
>From v4Rev example Field_Find.rev<br>
We do a Find Field based on a user name<br>
Then do a find field based on a password Then do a vset_intersect between<br>
the two results- that I can't get to work<br>
<br>
Is there a better way?<br>
<br>
Why is my vset_intersect returning the - fatal signal 11 error which is<br>
usually a wrong object being used.<br>
<br>
<br>
I'm removed a lot of debugging messages.<br>
This is the real meat of the script.<br>
I've had a really good look at vWiki but nothing looks close to the LiveCode<br>
script found in the v4Rev samples.<br>
<br>
Any help would be greatly appreciated.<br>
<br>
tia<br>
<br>
----<br>
on ValidateUsernameAndPassword<br>
<br>
<br>
initValentinaDB_AsLocalOrRemoteServer<br>
-- setup Database Object<br>
initValentinaDB_OpenConnectionLocalOrRemoteServer -- setup DB<br>
Connection Object<br>
initValentinaDB_OpenOrCreate<br>
-- setup Table and Fields Object<br>
<br>
-- Put "--Starting - SelectAll" & cr<br>
-- put VTable_SelectAllRecords( mGeoUser ) into allRecs -- this works<br>
returns all 10 recs<br>
-- get showError()<br>
-- ShowSet mGeoUser, allRecs<br>
<br>
put VField_FindValue( mUsername, gMyUsername ) into set1 --create a<br>
dataset of records that have this username -- Works - returns 1 rec<br>
-- put VField_FindRange( mUsername, true, gMyUsername, gMyUsername, true<br>
) into set1 -- Works -- returns 1 rec<br>
<br>
put VSet_Count(set1) into recount -- must do this here else: Fatal<br>
signal 11(usually wrong object) Don't know why<br>
<br>
ShowSet mGeoUser, set1<br>
<br>
if recCount < 1 then<br>
put recCount & " ***** Valid Username not found: " & gMyUsername & "<br>
- " & mUserName<br>
end if<br>
<br>
put "mPassword: " & mPassword & " - gMyPassword: " & gMyPassword & cr<br>
<br>
put VField_FindValue( mPassword, gMyPassword ) into set2 --create a<br>
dataset of records that have this password -- works returns 1 rec<br>
-- put VField_FindRange( mPassword, true, gMyPassword, gMyPassword, true<br>
) into set2 -- works returns 1 rec<br>
<br>
put VSet_Count(set2) into recount -- must do this here else: Fatal<br>
signal 11(usually wrong object) Don't know why<br>
<br>
ShowSet mGeoUser, set2<br>
<br>
if recCount < 1 then<br>
put recCount & " ***** Valid Password not found: " & gMyPassword & "<br>
- " & mPassword<br>
end if<br>
<br>
<br>
-- Now combine the two RecID Datasets - should only have 1 record - if<br>
two then there a duplicate UID/PW combo recs<br>
<br>
<br>
<br>
put VSet_Intersection( set1, set2) into set3 -- I get a fatal signal 11<br>
here - (usually using the wrong object) ************<br>
<br>
<br>
<br>
put VSet_Count(set3) into recount -- must do this here else: Fatal<br>
signal 11(usually wrong object) Don't know why<br>
<br>
ShowSet mGeoUser, set3<br>
<br>
<br>
if recCount < 1 then<br>
put recCount & " ***** Valid Username and Password combination not<br>
found: " & gMyPassword & " - " & mPassword<br>
end if<br>
<br>
<br>
--Always get error on these destructors: livecode-server exited due to<br>
fatal signal 11<br>
-- put VSet_Destructor(set1) into set1<br>
-- put VSet_Destructor(set2) into set2<br>
<br>
end ValidateUsernameAndPassword<br>
<br>
_______________________________________________<br>
Valentina mailing list<br>
<a href="mailto:Valentina@lists.macserve.net">Valentina@lists.macserve.net</a><br>
<a href="http://lists.macserve.net/mailman/listinfo/valentina" target="_blank">http://lists.macserve.net/mailman/listinfo/valentina</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><a href="http://www.bluewatermaritime.com">http://www.bluewatermaritime.com</a><br>