if record[arr_curr()].firstelement != record[arr_curr() -1].firstelement then do thisend ifif record[arr_curr()].secondelement != record[arr_curr() -1].secondelement then do thisend ifetc.
define originalRecord record like recordArray[1].* input array recordArray from screenArray before row let originalRecord = recordArray[arr_curr()].* after row call compareRows(originalRecord, recordArray[arr_curr()]) end inputfunction compareRows(originalRecord, currentRecord) define originalRecord record, currentRecord record, n integer for n = 1 to originalRecord.getlength() if originalRecord.[n] = currentRecord[n] then //code to log change in database end if end forend function
MAINTYPE coordType RECORD lat, lng DECIMAL(9,5)END RECORD DEFINE x1, x2 coordTypeDEFINE x3 STRINGDEFINE x4 RECORDlng, lat DECIMAL(9,5)END RECORD LET x1.lat = 10 LET x1.lng = 10 -- Test for same LET x2.* = x1.* CALL record_diff (base.TypeInfo.create(x1),base.TypeInfo.create(x2)) -- Test for different structure length CALL record_diff (base.TypeInfo.create(x1),base.TypeInfo.create(x3)) -- Test for different structure elements CALL record_diff (base.TypeInfo.create(x1),base.TypeInfo.create(x4)) -- Test for same structure different values LET x2.lat = 20 CALL record_diff (base.TypeInfo.create(x1),base.TypeInfo.create(x2))END MAIN FUNCTION record_diff(r1,r2)DEFINE r1, r2, f1, f2 om.DomNodeDEFINE i INTEGER -- Check length IF r1.getChildCount() != r2.getChildCount() THEN DISPLAY "Record length is different" RETURN END IF -- Check record structure is same FOR i = 1 TO r1.getChildCount() LET f1 = r1.getChildByIndex(i) LET f2 = r2.getChildByIndex(i) IF f1.getAttribute("name") != f2.getAttribute("name") THEN DISPLAY "Record structure is different" RETURN END IF IF f1.getAttribute("type") != f2.getAttribute("type") THEN DISPLAY "Record structure is different" RETURN END IF END FOR -- Record structure is same, check values FOR i = 1 TO r1.getChildCount() LET f1 = r1.getChildByIndex(i) LET f2 = r2.getChildByIndex(i) IF f1.getAttribute("value") != f2.getAttribute("value") THEN DISPLAY SFMT("Element %1 has different values %2 != %3",f1.getAttribute("name"), f1.getAttribute("value"),f2.getAttribute("value")) RETURN END IF END FOR DISPLAY "Record elements are the same" RETURNEND FUNCTION
define originalRow om.domnode, cellData om.domnode input array p_freight from s_dfreight.* before row let originalRow = base.typeinfo.create(p_freight[
function compare_input(originalInput, currentInput) define originalInput om.domNode, currentInput om.domNode, originalCell om.domNode, currentCell om.domNode, dropDown ui.combobox, i integer for i=1 to originalInput.getchildcount() let originalCell = originalInput.getchildbyindex(i) let currentCell = currentInput.getchildbyindex(i) let dropDown = ui.combobox.forName(originalCell.getAttribute("name")) if originalCell.getattribute("value") != currentCell.getattribute("value") then if dropDown is null then let scratch = originalCell.getattribute("name"), " changed from ", originalCell.getattribute("value"), " to ", currentCell.getattribute("value"), "." else let scratch = originalCell.getattribute("name"), " changed from ", dropDown.getitemtext(originalCell.getattribute("value")), " to ", dropDown.getitemtext(currentCell.getattribute("value")), "." end if call fgl_winmessage("",scratch,"") end if end forend function