Event Rules - Translate an Update SQL Statement to ER Table IO

bbass

Member
Hello, I'm a long time developer but a brand new EntOne Developer, so forgive me if this is a elementary question...I have looked for an answer but have not found it. Basically all I want to do in a form is what the following SQL statment would accomplish:

Update Schema/Table
SET
TblFld = FrmFldB
WHERE
TblFld = FrmFldA

I have a very simple Fix/Inspect form (would this be the correct form type to use for this) with 2 text input fields (FrmFldA, FrmFldB) and a Button (that will process the above SQL logic). I have an appropriate BV associated with the form, however, directly updating the table would be fine also. In the Button Clicked ER, is it a two step process where you would do a Table IO Select, then a Table IO Update to the BV/Table? I've tried both and haven't been able to get it to work. What am I missing to implement this SQL logic with ER? Thank you for your help.
 
bbass,

When asking a question, it is always good to provide as much information as you can - every little bit helps us to help you. In general it is good to provide the following:

1) Always provide your system config

and where applicable:

2) Appropriate event rules
3) Appropriate Logs, especially debug logs
4) Appropriate Screen prints

If needed, the event rules, logs and screen prints can be attached to your post - one file per post. Therefor it may be an idea to put then all into a zip file and attach the zip file to a single post.

From what you have described, one possible reason is that the table i/o mapping may not have been completed. I have made this mistake a number of times, especially when I've been in a hurry. I put in the variable name and the column to which it relates but forget the middle relatiosnhip options (=, <, >, etc).Check your mapping and make sure that all is OK, especially the relaionshp option.
 
Did you check if the form properties are correct for update in your Fix/Inspect?.
 
bbass,

1) What is the primary key on the table?
2) Is TblFld part of the primary key?

If using a Fix/Inspect with a business view, the Forms engine wants to update one specific record when you press 'OK'...assuming you've entered the form by passing the primary key fields via the form interconnect.

3) Does your requirement need to update multiple records based on the input criteria? If so, you'll need to do some kind of Select/FetchNext/Update loop. However, if TblFld is part of the primary key, this method will require a bit of a workaround. In short, ER Table I/O is not capable of updating a primary key field. The workaround is to replace the Update with a Delete/Add. C business functions utilizing the JDB_UpdateTable api is another alternative to the Table I/O workaround.

We need more info from you to help you further.
 
Back
Top