Search results

  1. U

    Error Use functions in for each statement

    Just to clarify my statements, I hack over your sample. Changing the for-first to a for-each will demonstrate why you don't use functions in the where clause. <code> def temp-table tt no-undo field ok as log. def var i as int. create tt. tt.ok = true. create tt. tt.ok = true. create tt...
  2. U

    Error Use functions in for each statement

    I agree with Rob, you don't use user defined functions in a for each select. It is my understanding that a user-defined function will execute only on the first iteration and that result will be used for all other iterations. If you need to use the function, then do it within the for-each block...
  3. U

    Piew - Free Progress Code Editor

    Re: New version To answer your syntax question. It works for me, although I had to do some tweaking. Here is a snippet of the syntax file that I use: COMPILE VALUE(SESSION:PARAMETER) SAVE = NO NO-ERROR. IF /*COMPILER:ERROR*/ COMPILER:NUM-MESSAGES GT 0 THEN DO: ASSIGN cMsg = "". DO i...
  4. U

    beauty.p for Progress v8 and above (win32)

    Check out the Progress 4GL Editor PIEW. One of its tools is a code beautifier. It can be downloaded from http://progress-tools.x10.mx
  5. U

    Query error raises a STOP?!?

    First, Stefan thanks for a very interesting issue. I did some research, and some testing and came away with the following: 1) Research: STOP & QUIT are not captured by CATCH. 2) ENTRY(0,...) when used in the FOR-EACH where clause can only be trapped (ON STOP) in the outer FOR-EACH block, not...
  6. U

    Dynamic Buffer, No-Error

    I'm curious what you changed since post#10 where you added TRANSACTION to your code. Are you processing an ON-ERROR or the buffer not being AVAILABLE? Can you share a snippet of your code.
  7. U

    Dynamic Buffer, No-Error

    This one has my juices flowing. The left side of the equals is an assign and the find is on the right side, therefor I believe the no-error goes with the assign. (someone correct me if I'm wrong). Try this instead: bh:find-first("....") no-error. if bh:available then do...
  8. U

    Dynamic Buffer, No-Error

    I missed seeing that. Thanks for the catch. My eyes are getting old, along with the body.
  9. U

    Dynamic Buffer, No-Error

    Based on your code, I believe your program is failing in the "if then else" after the FIND. You set a local logical variable to true or false based on the results of the FIND. If the FIND is successful, you make some buffer assignments, if not successful, you also make some other buffer...
  10. U

    try ... catch ?

    Here is a sample of simple structured error handling that I used to catch a server issue when opening file that would not be captured using the error-status. Maybe this would help your case. Good luck. procedure Open_Stream: def var cMsg as char no-undo. do transaction on...
  11. U

    Query object question

    I should have read the previous response. Mendu has the same response.
  12. U

    Query object question

    Two things need to be done for num-results: 1) use handle:num-results (already mentioned). 2) Change your "for each: to "preselect each". Num-results after an open with "for each" will return 0, "preselect" will return the query count.
  13. U

    help need to find number of records on a query.

    /*Here is a small utility that allows you count records in multiple tables using SQL or ABL . Change the scoped-define for your table or leave the scoped-define empty. Hope this helps*/ &SCOPED-DEFINE TBL1 customer &SCOPED-DEFINE TBL2 employee &SCOPED-DEFINE TBL3 billto &SCOPED-DEFINE TBL4...
  14. U

    help need to find number of records on a query.

    One way to find the number of records in a query is to change your query-prepare from "for each" to "preselect each" and after you open the query use the method h_query:num-results to obtain the number of rows. This is not a fast method of obtaining the count, but it works. "Preselect" does...
  15. U

    temp-table handles

    You need to define a handle for your table tt-table. def var hTT as handle no-undo. Initialize the handle. hTT = buffer tt-table:handle. Access your fields: def var hName as handle no-undo. hName = hTT:buffer-field(substitute("&1&2","name",l-idx)):handle. I suggest that you change your...
  16. U

    "Last Day of the Month" and Date-to-Char Formatting

    I found a month-end function (someone else developed the code - no credit to me) that I have used before and maybe you can adapt it to your requirements. Function MonthEnd Returns Date ( input inDate As Date): Return (Date(Month(inDate),28,Year(inDate)) + 4) -...
  17. U

    "Last Day of the Month" and Date-to-Char Formatting

    I see at least two way of handling your requirement: 1) string function to format the date, e.g. string(today /*some date field*/, "99-99-99"). This is assuming that the date format is "MM/DD/YYYY". 2) If you need to break down the date into individual components, you can use the substitute...
  18. U

    Dispatch-1 documentation?

    Two people working on Dispatch-1! Maybe we should send Zack an email and see if he is interested in reviving D-1. As a former employee (10 years ago), I doubt seriously that you will find any documentation, especially on-line. Even when I was employed with them, the documentation that existed...
  19. U

    Is This a Bug?

    As I understand it, In a "for each" loop, user defined function are evaluated "only once". With that assumption and with your "find first", I imagine the same is true. Try the function test after the "find first" and you will be ok.
  20. U

    add char to each line in a variable

    Here is simple example on how this can be done: def var cinList as char no-undo. def var coutList as char no-undo. def var i as int no-undo. assign cinlist = "Bill~nDick~nTom~nHarry". do i = 1 to num-entries(cinList, "~n" /*chr(10)*/): display entry(i,cinlist,"~n" /*chr(10)*/ ) skip...
Top