adding, deleting, etc. dbase records

angie3742

New Member
Ok, my 3 pages are working as they should. The first page is where the sales rep specifies who they are and for which time period to view their contracts. The second page displays a table of the specific contracts from which they can choose to view more info for a particular contract number (by clicking the hyperlinked contract # for that particular row). This sets a field for contractid and passes it to the third page where all the details for this contract are displayed. NOW, I want to create buttons that will enable the rep to add, update, delete. Is it really as convoluted as the Webspeed Wizard makes it out to be? Does anyone have an example of an easier way of doing it? Any help is greatly appreciated.
 

sexylee

New Member
Hi there.
Maybe you have figured out how to do it already, but in case you have not. Here we go.
First of all the Html page must have a <form action="`selurl`" method="post">
At the bottom you create 3 submit buttons with 3 different names ie name="Update" value="Update" & name="Add" value="Add" etc.
At the top of the page you have your webspeed script.
<!--wss
if get-value("Update") <> "" then do:
find first whatever where whatever.this = get-value("value")
no-lock no-error.
if avail whatever then do:
assign whatever.this = get-value("avalue").
end.
end.
-->
<!--wss
if get-value("Add") <> "" then do:
create whatever.
assign whatever.this = get-value("avalue").
end.
-->
Hope this is of help to you, and I hope I understood your question properly.
Cheers Lee
 

angie3742

New Member
Thanks Lee. I think this will prove to be very helpful. I knew there had to be a simpler way of doing it rather than using the wizards. Thanks again.

Angie
 

angie3742

New Member
Lee - if you're still out there.....

Here's some of my code. It's still now working for me. Did I miss something?
</head>

<body>
<form action="`SelfURL`" method="POST" name="upd_cntrct">
<script language=speedscript>
if get-value("Update") <> "" then do:
find first cntrct where cntrct.int-cntrct = get-value("cntrct_int-cntrct")
no-lock no-error.
if avail cntrct then do:
create cntrct.
assign cntrct.cust = get-value("cntrct_cust").
assign cntrct.part = get-value("cntrct_part").
assign cntrct.effective = date(get-value("cntrct_effective")).
assign cntrct.expires = date(get-value("cntrct_expires")).
assign cntrct.price = decimal(get-value("cntrct_price")).
assign cntrct.spec-cost = dec(get-value("cntrct_speccost")).
assign cntrct.contract = get-value("cntrct_contract").
assign cntrct.force = get-value("cntrct_force") = "Yes".
assign cntrct.free-frght = get-value("cntrct_freefrght") = "Yes".
assign cntrct.comments = get-value("cntrct_comments").
{&out} "<p>" decimal(get-value("cntrct_price")) "</p>".
end.
end.
</script>

My button looks like this:
<td align="center"><input type="submit" name="Update" value="Submit Updates"></td>

I'm not getting any error messages. But it's not writing to the database.

Thank again.
Angie
 

sexylee

New Member
Hi there.
first of all if you find the record (IF AVAIL cntrct), then why are you creating (create cntrct) another one.
Second of all when you write to the database, you can't use no-lock, you have to use exclusive-lock.
Let me know if you have any problems, maybe we can exchange email or ICQ addresses.
Cheers Lee.
 

angie3742

New Member
Lee - You are right. I don't need the (If available) etc. All I really want to do is (create cntrct) upon clicking the submit button. I appreciate your help. This is still very new to me. I've managed to get through a few easier projects with no problem - but this one is giving me a headache. :) My email address is angiec@3ciusa.com if you want to email me there.

Here's the way my speedscript looks now:
<script language=speedscript>
if get-value("Update") <> "" then do:
create cntrct.
assign cntrct.cust = get-value("cntrct_cust").
assign cntrct.part = get-value("cntrct_part").
assign cntrct.effective = date(get-value("cntrct_effective")).
assign cntrct.expires = date(get-value("cntrct_expires")).
assign cntrct.price = decimal(get-value("cntrct_price")).
assign cntrct.spec-cost = dec(get-value("cntrct_speccost")).
assign cntrct.contract = get-value("cntrct_contract").
assign cntrct.force = get-value("cntrct_force") = "Yes".
assign cntrct.free-frght = get-value("cntrct_freefrght") = "Yes".
assign cntrct.comments = get-value("cntrct_comments").
{&out} "<p>This is the stored price:" decimal(get-value("cntrct_price")) "</p>".
end.
</script>
 

Jens

New Member
I don't know if you've managed this yet. But what you do in the last exemple is that you create a new contract and assign values to it, shouldn't you find the appropriate contract (find first contract where contract.id = get-value("contractid") etc etc) and then update the values of that contract?

Regards
Jens
 

angie3742

New Member
Thanks very much to everyone who helped! It's finally working as it should. It was a combination of things - one of the triggers was not working as it should for the create statement; and I didn't realize I couldn't use the get-value when assigning a record. So we corrected the trigger problem; I established variables for the get-value fields and used the variables in my assign statement. :)

Thanks again!
 

rcgomez11

Member
ei lee, i've read your threads regarding the add, edit, delete functions of progress..i'm new with progress especially in webspeed can you cite some example where i can personally manipulate the codes for me to learn about these functions i said above...thank you lee,hoping for your kind response....any help will be appreciated...thanx...i have accounts on skype(rcgomez11) and yahoo messenger(romel_gomez11), if it is possible i can surf this medium for much clearer talk...thanx again...
 
Top