Post Reply 
 
Thread Rating:
  • 30 Votes - 2.63 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modify Record
04-03-2017, 12:11 PM
Post: #1
Modify Record
Hi every body ! I have a problem about modify RecordSet after get from database via connection.
This is my source code .
=========================================================

{import * from CURL.DATA-ACCESS.BASE}
{import * from CURL.DATA-ACCESS.CONNECTED}
{let connection:BasicConnection =
{BasicConnection {url "http://192.168.1.18:9999/cdbc-server/CdbcServlet"}}
}
{let sqlChart:String={String
"SELECT E.EMPLOYEE_ID,
E.FIRST_NAME,
E.LAST_NAME,
E.EMAIL,
E.PHONE_NUMBER,
E.HIRE_DATE,
E.JOB_ID,
E.SALARY,
E.COMMISSION_PCT,
(SELECT CONCAT(CONCAT(S.FIRST_NAME,' '),S.LAST_NAME) FROM EMPLOYEES S WHERE S.EMPLOYEE_ID = E.MANAGER_ID) AS MANAGER ,
D.DEPARTMENT_NAME
FROM EMPLOYEES E LEFT JOIN DEPARTMENTS D
ON E.DEPARTMENT_ID = D.DEPARTMENT_ID"
}
}

{let rsbase:RecordSet={connection.create-record-set "HR","EMPLOYEES",request-modifiable?=true}}
{define-proc {get-all-record rss:RecordSet}:RecordSet
{let rsMod:RecordSet =
{RecordSet
{RecordFields
{RecordField "f_name",caption = "FIRST NAME", domain = String},
{RecordField "l_name",caption ="LAST NAME",domain = String}
}
}
}
{for r:Record in rss do
{rsMod.append{RecordData f_name = r["FIRST_NAME"],l_name = r["LAST_NAME"] }}
}
{return rsMod}
}
{let rs:RecordSet = {get-all-record rsbase}}
{value rs.size}

=================================================================
it's seem a problem happend in my proc get-all-record,I couldn't modified RecordSet. Please tell me about this problem. Thanks
Find all posts by this user
Quote this message in a reply
04-03-2017, 01:23 PM (This post was last modified: 04-03-2017 01:27 PM by dyoshida.)
Post: #2
RE: Modify Record
Before appending a new record, you need to create a new record using Recordset.new-record method.

Code:
{for r:Record in rss do
|| {rsMod.append{RecordData f_name = r["FIRST_NAME"],l_name = r["LAST_NAME"] }}
    def nr = {rsMod.new-record}
    {nr.set "f_name", r["FIRST_NAME"]}
    {nr.set "l_name", r["LAST_NAME"]}
    {rsMod.append nr}
}
Find all posts by this user
Quote this message in a reply
04-03-2017, 01:58 PM
Post: #3
RE: Modify Record
(04-03-2017 01:23 PM)dyoshida Wrote:  Before appending a new record, you need to create a new record using Recordset.new-record method.

Code:
{for r:Record in rss do
|| {rsMod.append{RecordData f_name = r["FIRST_NAME"],l_name = r["LAST_NAME"] }}
    def nr = {rsMod.new-record}
    {nr.set "f_name", r["FIRST_NAME"]}
    {nr.set "l_name", r["LAST_NAME"]}
    {rsMod.append nr}
}
Thank you very much ! Smile I wil try it .
Find all posts by this user
Quote this message in a reply
05-04-2017, 07:36 PM
Post: #4
RE: Modify Record
Nice post

Regards
viagra 100mg online

Buy generic viagra soft tabs online
Buy Kamagra Online
Buy Super P Force online viagra generics online
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Record の選択について umemura 2 2,592 11-01-2011 02:58 PM
Last Post: umemura
Forum Jump:


User(s) browsing this thread:
1 Guest(s)