Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 15 JAN 1999 04:14:18PM Gene Sorbo EMS wrote:

Hello again,

I'm struggling with a couple of things in OI that I use to do in AREV quite easily - I was hoping there might be a couple of quick answers from the OI faithful (of which I am hoping to become)

1) On a form write or other save event, is there a way to quickly determine if the record has changed since being read into the form (AREV comparison of @RECORD vs ORIG.REC/OREC)?

2) I want to write a routine to allow the user to import an ASCII file into an OI table. What OI command or utility should I be using? Is there OI support for AREVs IMPORT.READ routine?

3) How can I read all of the controls and associated values that exist on a particular form via a stored procedure called from that form?

4) From one MDIFrame form, can I start another MDIFrame form based on a popup, pass the key to the 2nd form, and close the first form? I know the answer lies in either START_WINDOW or START_MDIFRAME, but have not had any luck with either from a called stored procedure.

Any answers and/or example code will be much appreciated.

Gene Sorbo

[email protected]


At 16 JAN 1999 05:47PM Don Bakke wrote:

Gene,

1) On a form write or other save event, is there a way to quickly determine if the record has changed since being read into the form (AREV comparison of @RECORD vs ORIG.REC/OREC)?

Checking the SAVEWARN property of the window will tell you if there has been a change. If you want to compare the original record to the current record then you need to store the value of the RECORD property just after the row has been read and then get the RECORD property just before it gets written and compare the two. We generally create a user defined property called @ORIG_RECORD in our READ events for this purpose.

2) I want to write a routine to allow the user to import an ASCII file into an OI table. What OI command or utility should I be using? Is there OI support for AREVs IMPORT.READ routine?

Have you looked at the IMPORT_ASCII form executable in OI yet? This might do what you want.

3) How can I read all of the controls and associated values that exist on a particular form via a stored procedure called from that form?

If all you are trying to do is get an @RECORD type of functionality, then just use the RECORD property of the window and you are set. If you really want a list of controls then you can either call Utility("OBJECTLIST") or insert the OIWIN_COMM_INIT record in your code and use the ControlMap@ common variable. Then just loop through and get the DEFPROP or INVALUE properties of each control to get the current data value for each.

4) From one MDIFrame form, can I start another MDIFrame form based on a popup, pass the key to the 2nd form, and close the first form? I know the answer lies in either START_WINDOW or START_MDIFRAME, but have not had any luck with either from a called stored procedure.

This is possible. You have to use Start_Window since Start_MDIFrame doesn't exist (there is a Start_MDIChild, but this is for launching child windows within an MDI Frame). Use the CreateParam to pass the key ID and then retrieve this key in the CREATE event of the second window. You can place a Post_Event call right after the Start_Window code to CLOSE the current window or you can have a Send_Event call in the CREATE event of the second window to close the first window.

[email protected]

SRP Computer Solutions

Any answers and/or example code will be much appreciated.


At 16 JAN 1999 10:52PM Gene Sorbo EMS wrote:

Don,

Thanks for the quick answers.

Regarding #3), How can I read all of the controls and associated values that exist on a particular form via a stored procedure called from that form?

In my application, on certain forms, I need to know not only if the record has been changed, but which fields have been changed. My thought was to have a stored procedure on the save event for a push first determine if the record had been changed, and then gather a list of the form controls looping through each one to compare the text values against the associated @RECORD value. This would allow for additional controls to be placed on the form, without having to recode the stored procedure to 'look for' the newly placed controls… .

Any additional thoughts?

Thanks again.

Gene


At 17 JAN 1999 05:46PM Don Bakke wrote:

Gene,

Based on what your needs are, you don't have to worry about comparing every control. Just get the RECORD property just after the READ event, store that in an easy place to retrieve (e.g. @ORIG_RECORD property) then get the RECORD property again during the WRITE event and compare it to @ORIG_RECORD. This eliminates the need for complex field position determination for every control and it only needs to be done once regardless of how often you add or remove controls.

[email protected]

SRP Computer Solutions


At 17 JAN 1999 10:01PM Gene Sorbo wrote:

Don,

I have tried adding the following code to the read event of the window via a quick event with no success:

currrec =Get_Property(@window, "RECORD")

storedrec=Set_Property(@window, "@ORIG_RECORD", currrec)

when debugging:

msg("currrec=:currrec) displays null

msg("storedrec=:storedrec) displays null

What am I missing?

In addition, I do actually need to examine the value of each control to see if it changed from what was originally on the form to start with, as I am writing out a future dated transaction to a table that contains the control/field name, future date, @id, old value and new value (row is not saved, but selected data is written to a 'PENDING' table for future exeuction and 'saving').

I got the following code to accomplish most of the comparison task:

alleditfields =utility('OBJECTLIST', @window, 'EDITFIELD')

count_editfields=count(alleditfields,@fm) + (alleditfields ne '')

For I=1 to count_editfields

control_name=alleditfields[i] 
column_name =get_property(control_name, "COLUMN")
column_value=get_property(control_name, "TEXT")
  • Following db_value gets the value as stored in the database, if
  • conversions (date, md2 or otherwise) are present does not work as
  • the converted value presented on the form differs from the value * being stored
db_value=xlate(window_file,@id,column_name,"X")
If column_value ne db_value then
  MSG("Value has changed!")
End

Next I

My next thought was to XLAT to the dictionary for the file, get the output conversion as it exists there if any, apply it to the db_value, then compare to the control value…!

As before, any additional thoughts or feedback would be appreciated.

Thanks again Don.

Gene


At 17 JAN 1999 10:05PM [email protected] wrote:

Gene,

]]In my application, on certain forms, I need to know not only if the record has been changed, but which fields have been changed.

The easiest way to handle this is with a GetFocus/LostFocus procedure. We have one that happens on every control. This procedure handles 3 major functions:

1) GotFocus: displays the control 'help' to the status line

2) GotFocus: changes the color of the control (editline, table etc) so that the user can see which control has focus.

 LostFocus: changes color back to original color.

3) GotFocus: Gets the current value of the field and stores in Window User Created Property @GOTVALUE.

 LostFocus: Gets the current value of the field, gets the original value from User Created Property @GOTVALUE and compares.  At this point IF this is a field we care about we process as needed.  This is where you could put any processing you need OR save the field name etc.

[email protected] onmouseover=window.status=you have seen the rest .. now try the best!;return(true)"

David Tod Sigafoos ~ SigSolutions

voice: 503-639-8080


At 17 JAN 1999 10:17PM [email protected] wrote:

Gene,

After the Read process you may use @Record .. so

Set_Property(@Window,"@ORIG_RECORD",@Record)

]]In addition, I do actually need to examine the value of each control to see if it changed from what was originally on the form to start with, as I am writing out a future dated transaction to a table that contains the control/field name, future date, @id, old value and new value (row is not saved, but selected data is written to a 'PENDING' table for future exeuction and 'saving').

As I mentioned in my other post .. just save and check the values at got/lost focus

In the GotFocus event get the current value and save to @Window property. Then in Lostfocus, get current value and the saved value and compare. If they are not the same then simply put the field, value and whatever else you need in another window property.

IF you really need to look at each control at write time you could use the 'ctrlmap' property of the window. I find it a little easier than 'objectlist'.

Hope this doesn't just muddy the waters ..

[email protected] onmouseover=window.status=you have seen the rest .. now try the best!;return(true)"

David Tod Sigafoos ~ SigSolutions

voice: 503-639-8080


At 18 JAN 1999 08:55AM Don Bakke wrote:

Gene,

currrec=Get_Property(@window, "RECORD") storedrec=Set_Property(@window, "@ORIG_RECORD", currrec) when debugging: msg("currrec=:currrec) displays null msg("storedrec=:storedrec) displays null

The variable currrec should have data in it. How exactly are you executing this code? If you do it directly from the READ event script then you need to do a Forward_Event() first. If you call a commuter module/OMNIEVENT script from the QuickEvent then this should work. The storedrec variable equals null because you need to Get_Property once you've set it - but if currrec equals null to begin with then storedrec will equal null anyway. I'm assuming that your Msg statements are in the same block of code as your Get/Set_Property commands.

With the control/field comparison, I'd just get the INVALUE property of each control and compare that to the XLATEd data. INVALUE gives you the internal format of your data in your controls so you don't have to do any output conversion later on for accurate matching.

[email protected]

SRP Computer Solutions


At 18 JAN 1999 08:39PM Gene Sorbo EMS wrote:

Don and Dave

Thanks for your help, your suggestions were right on and exactly what I needed to bridge my knowledge gap.

Just as an aside, do either of you guys know if these are the types of topics covered in the RTI OI 3 day basic training course? I am considering going but want to make sure that the content is more intermediate to advanced then basic.

Thanks again.

Gene


At 18 JAN 1999 09:41PM Don Bakke wrote:

Gene,

Never took the course so you may want to check the website for the training itinerary or post a message for Mike Ruane who handles the training for RTI.

[email protected]

SRP Computer Solutions


At 19 JAN 1999 02:42PM [email protected] wrote:

Gene,

Like Don I dont really know what is done at the class now. Have heard good and bad but the best guy to talk to is

[email protected]

[email protected] onmouseover=window.status=you have seen the rest .. now try the best!;return(true)"

David Tod Sigafoos ~ SigSolutions

voice: 503-639-8080

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/fb386ada71915019852566fa0074aa80.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1