Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
For ERP LN feature pack upgrade, what method of install are you using?
Installation Wizard into existing VRC
33%
Installation Wizard into new VRC
39%
Manual into existing VRC
6%
Manual into new VRC
22%
Total votes: 49

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 14th August 2018, 12:50
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 77
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
[Extension] How to execute "save" (update.db form command)?
Baan: Other/Unknown
C/S: None/Unknown

Hi,

I am trying to save current record in a session using Extension.
I have tried
- execute(update.db)
- dal.save.object() with dal.change.object() and dal.set.field()
but no luck. The record is not saved.
What is the correct solution to do this?

Regards,
Thana
Reply With Quote
  #2  
Old 14th August 2018, 14:05
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 788
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Can you elaborate a little bit more on your scenario? When do you want to save the current record? Which hook do you use in the extension?
Reply With Quote
  #3  
Old 15th August 2018, 03:37
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 77
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
In Extension tisfc0101m100 type Session. Inside the Extension Modeler, I created a Custom Form Command which contains this snippet.

Code:
 . . .
tisfc001.qrdr = tisfc001.qrdr + 500 |* Just update the quantity
display.all() |* This will not be needed if it can save and redisplay by itself
execute(update.db) |* Try to save but it doesn't work
 . . .
I wrote this in the Command Execute hook so when the form command is activated, it will run this code, in which it runs without any errors but the save command just does not do its job.
Reply With Quote
Sponsored Links
  #4  
Old 15th August 2018, 06:08
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 77
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
Solution Found

The problem is now solved using this solution.

Code:
select  tisfc001.qrdr
from    tisfc001 for update
where   tisfc001.pdno = :tisfc001.pdno
selectdo
        db.retry.point()
        if dal.change.object("tisfc001") <> 0 then
		dal.get.error.message(error.msg)
		dal.set.message(MSG.ERROR, "@DAL Error: " & error.msg)
                show.dal.messages()
	endif
	dal.set.field("tisfc001.qrdr", tisfc001.qrdr + 500)
	if dal.save.object("tisfc001") <> 0 then
		dal.get.error.message(error.msg)
		dal.set.message(MSG.ERROR, "@DAL Error: " & error.msg)
                show.dal.messages()
	endif
        commit.transaction()
endselect
prcm.notify("tisfc001")
The important thing that forces it to save is "commit.transaction()", and to make the value redisplay in the session, I use "prcm.notify()" with the table I just updated one of its value.
Reply With Quote
  #5  
Old 15th August 2018, 09:47
JaapJD's Avatar
JaapJD JaapJD is offline
Guru
 
Join Date: Sep 2002
Location: Netherlands
Posts: 788
JaapJD will become famous soon enoughJaapJD will become famous soon enough
Baan: BaanIV, BaanERP, ERP LN 6.1 - DB: Oracle, SQL Server - OS: Unix, Windows
Two remarks: the db.retry.point() must be before the select. And instead of prcm.notify, I would use refresh.curr.occ().
Reply With Quote
  #6  
Old 15th August 2018, 12:15
tmannais's Avatar
tmannais tmannais is offline
Member
 
Join Date: Jul 2017
Posts: 77
tmannais is on a distinguished road
Baan: LN 10.5 - DB: MySQL - OS: Windows
Thank you for your advice.
I will keep that in mind.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Question mr_suleyman Tools Development 37 11th November 2016 08:14
change Form Command Availability at run time aamir_faried Tools Development 7 5th January 2015 20:59
Handling Unit functionality baazigar Distribution, Transportation & Warehousing 4 19th February 2012 15:54
Linked Form Command question benito Tools Development 1 13th April 2011 17:56
Form Button for a Standard Command baan_fun Deutsches Forum 2 13th May 2004 11:45


All times are GMT +2. The time now is 17:01.


©2001-2018 - Baanboard.com - Baanforums.com