Posts

Showing posts with the label open edge

Progress 4GL interview questions for QAD technology

1.        What is “No-undo” in the variable declaration? 2.        What are the different .pf parameters 3.        What are the different types of  locks in progress? Explain with example. If a record is locked Exclusively, can a shared lock be provided over the same? 4.        What are different type of procedures in progress? Can internal procedure call other internal procedure? If yes how? If no why no? Can external procedure call internal procedures? 5.        How is array defined in progress? What is the limit of extent for progress? Can we create 2 dimensional / multi dimensional arrays in progress / How? If no then how can we achieve the same? 6.        What are browses? 7.        What are queries? 8.        Can we call excel application from progress? How? 9.        What is the difference between can-find and find? 10.     What are the different types of triggers available in progress? Name few database level triggers. 11.     What are the different type

Progress 4GL/Open edge Code to fetch First and Last date of any month.

In the below example we have fetched the First and Last Date of the current month, you can customized it and can use as per your requirement. Define variable date1 as date no-undo. Define variable date2 as date no-undo. run Default_date. Message "First Date of Current Month" date1 " ----" " Last Date of Current Month " date2  view-as alert-box. PROCEDURE Default_date:      Define variable m_session as character no-undo.      Assign        m_session     = SESSION:DATE-FORMAT.    IF INDEX (m_session , "m") = 2 THEN    do:        IF INDEX (m_session , "y") = 3 then        do:             IF Month(Today) <> 12 THEN        Assign     date1 = date("01" + "/" + String(Month(Today)) + "/" + String(YEAR(TODAY)))     date2 = date("01" + "/" + String ( ( Month(Today) + 1 ) ) + "/" + String ( YEAR(TODAY)) ) - 1.             else        Assign

Sample Progress 4GL Query to check duplicate customer in the table

Sample Query to check duplicate customer in the table Define buffer mBuf FOR xx_mstr. Define buffer kBuf FOR xx_mstr. Define temp-table tt    Field tt_recid as recid .  Empty temp-table tt.  Output to "Duplicate_records.xls".  FOR EACH each xx_mstr no-lock :     FIND first tt where tt_recid = recid(xx_mstr) no-lock NO-ERROR.     IF avail tt THEN next.     FIND First mBuf where mBuf.cust-num = xx_mstr.cust-num and recid(mBuf) <> recid(xx_mstr) no-lock no-error.     IF avail mBuf THEN     do:       Export delimiter "~011" mBuf.       FOR EACH kbuf where kbuf.cust-num = xx_mstr.cust-num :            create tt      Assign tt_recid = recid(mBuf).             END.     End.          END.  output close.

use of VST table _lock, to determining if record is lock

/*Below query checks if Purchase order 10765 is locked */ {us/mf/mfdtitle.i} find first po_mstr where po_domain = global_domain and po_nbr = "10765" exclusive-lock NO-WAIT no-error. if avail po_mstr then   Message po_nbr view-as alert-box. If locked po_mstr then do: find first po_mstr where po_domain = global_domain and po_nbr = "10765" no-lock no-error. for first _lock where _Lock._Lock-Recid = Integer (RECID(po_mstr)) no-lock :     find first _file where _File._File-Number = _Lock._Lock-Table no-lock no-error.    message _File._File-Name " is locked by user " _Lock._Lock-Usr _Lock._Lock-Name view-as alert-box.   End. End.

Sample Query to fetch data with date range

/*Sample Query to fetch data with date range*/ Define variable m_date  as Date no-undo. Define variable m_date1 as Date no-undo. Repeat:     Assign       m_date  = ?       m_date1 = ?.       update m_date m_date1 with frame a side-label.             IF m_date  = ? THEN m_date1 = low_date.       IF m_date1 = ? THEN m_date1 = hi_date.            FOR EACH tr_hist where tr_domain = global_domain and tr_effdate >= m_date and tr_effdate <= m_date1 no-lock :            END.       End.

QAD - Check the type of location - Progress 4gl

Take locations from Excel, fetch its type and generate new Excel with type DEFINE VARIABLE m_flepath AS CHARACTER FORMAT "x(40)" NO-UNDO . DEFINE VARIABLE m_fleout AS CHARACTER FORMAT "x(40)" NO-UNDO . DEFINE TEMP-TABLE tt_temp     FIELD tt_loc AS CHARACTER . FORM     m_flepath LABEL "File path " WITH FRAME a. REPEAT:     m_fleout = "" .     EMPTY TEMP-TABLE tt_temp .     UPDATE m_flepath WITH FRAME a .     m_fleout = SUBSTRING ( m_flepath , 1 , R-INDEX ( m_flepath , ".") - 1   ).     m_fleout = m_fleout + "log" + ".xls" .     INPUT  FROM value(m_flepath) .     REPEAT:         CREATE tt_temp.         IMPORT DELIMITER "," tt_temp.     END.     INPUT CLOSE.     FOR EACH tt_temp WHERE trim(tt_loc) = "" NO-LOCK  :         DELETE tt_temp .     END.  /* for each */     DO ON ERROR UNDO, RETRY :         OUTPUT TO value(m_fleout).         FOR EACH tt_temp NO-LOCK :          

Report showing junk characters for Chinese characters - Progress 4GL

Some time when we generate a report and it included some Chinese characters then system shows junk character in place of proper Chinese characters to overcome this issue while generating the output you should use code page which can understand Chinese character exp output stream ss to "hello.txt" CONVERT SOURCE  TARGET "UTF-8".