New call-to-action
Results 1 to 11 of 11

Thread: system->current_order

  1. #1
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default system->current_order

    I am hoping some clever person knows the variable name that contains the string shown in the Order Builder as the order expression in the report writer.

    In the report writer, system-"current_order gives the order expression and it can be convenient to display this on a report.

    If a calculated field, say MyCalc, is used in the order expression, then the expression for MyCalc replaces the text string "MyCalc" when system-"current_order is printed, e.g. system-"current_order=a+b+c vs. system-"current_order=MyCalc.

    For my report, it is more understandable to print out "MyCalc", so I am trying to find a way.

    The only thing I thought of was to do processing in OnPrintInit, but system-"current_order is not available at that time.

    Bill.

  2. #2
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default RE: system->current_order

    Hello Bill,

    If you report is named "MyReport", a calculated field placed on the report with the expression:

    :MyReport.filter

    should give you the unparsed filter expression, ie:

    FieldName=var-"MyVarName

    whereas the system current_filter field returns the evaluated filter expression, ie:

    FieldName="value in the variable"

    Good seeing you at the conference. I say we have two conferences a year, one in Boston in the spring and one in Iowa in the fall.

    Jim

  3. #3
    "Certified" Alphaholic
    Real Name
    JohnZaleski
    Join Date
    Oct 2000
    Posts
    1,736

    Default RE: system->current_order

    There is an Alpha function CURRENT_ORDER_EXPN(). The docs say:
    "To display the order expression that a report is based on, define a calculated field with this expression:
    Haven't tried it.

  4. #4
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default RE: system->current_order

    Thanks Jim. This is close...

    In the order expression builder the value for :Events.order displays correctly. If the report is run as a preview from dsign mode I get an error in the calculated field -
    :MyReport not found
    :MyReport.order

    If I save the report and run it, the report prints, but I get weird characters where the text is supposed to be.

    The current_order_expn() suggested by John is for table order, so your approach is probably what I need to figure out.

    Now if we want to experience Iowa at it's best, shouldn't we try to have a conference there in November to February?

    Bill.

  5. #5
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default RE: system->current_order

    While I am in the expression builder, the preview of cOrder = :MyReport.order shows the expression I want. However when printing cOrder field on the report I get an error that :MyReport.order is not found.

    Back in the calc field expression builder, F5 shows that the type is "F" for the cOrder calc field I defined. Anyone know what a type F is?

    If I play around a bit, it turns to a type= C. Then the report will print, but only if the report is saved first and preview is done from design mode. If design mode is closed, the error returns. Also the display object must be a text field, not a RTF.

    So I am close, but no banana yet.

    current_order_expn() just returned a blank field.

    Bill.

  6. #6
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,963

    Default RE: system->current_order

    Bill, it may be a timing issue. I had some reports where I was setting the value of an RTF field(that existed only on the report) with a text variable established before I got there. The way I finally got it to work was to put xbasic-wait-for-idle in the onprintinit event.

  7. #7
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default RE: system->current_order

    Good try Martin. xbasic_wait_for_idle() seems to make the report preview work consistently from design mode (sometimes before it did not), but I still get the error when running report from control panel.

    Bill.

  8. #8
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default RE: system->current_order

    Hello Bill,

    Try this in the reports onPrintInit event:

    dim global vOrder as c
    vRep = this.this
    vOrder = vRep.order

    Now add the vOrder variable onto the report. Works for me.

    Good luck,
    Jim

  9. #9
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default RE: system->current_order

    Selwyn says that :report.order is not a valid run-time property, so I have asked if this could be made available in the future.

    To recap, if your order expression is "calc-"MyCalc + field1" and calc-"MyCalc = "a+b", system-"current_order gives "a+b+field1", but there appears no way to get 'calc-"MyCalc +field1" outside of design mode.

    Bill.

  10. #10
    "Certified" Alphaholic
    Real Name
    jim chapman
    Join Date
    Apr 2000
    Posts
    1,779

    Default RE: system->current_order

    Hello Bill,

    Try this; remove any onPrintInit event code, and place a global variable named vOrder on the report. Then call the report with this code:

    dim global vOrder as c

    r = report.Load_Low("Customer List")
    vOrder = r.order
    r.close()

    report.preview("Customer List")

    This appears to work every time for me. We are creating a little overhead here, but I hope not too much.

    Jim

  11. #11
    VAR
    Real Name
    Bill Parker
    Join Date
    Apr 2000
    Location
    Dallas, TX
    Posts
    1,734

    Default RE: system->current_order

    Jim is the intrepid Alphaholic as usual.

Similar Threads

  1. Refreshing "Current_Order" field
    By Dave Wilson in forum Alpha Five Version 6
    Replies: 13
    Last Post: 09-23-2005, 04:28 AM
  2. Need system.alb
    By Kai Lange in forum Archived Wishlist
    Replies: 2
    Last Post: 02-04-2005, 09:52 PM
  3. system menu - system toolbar
    By Doug Chanley in forum Alpha Five Version 5
    Replies: 2
    Last Post: 12-01-2003, 04:26 PM
  4. System Specifications
    By Doug Chanley in forum Alpha Five Version 5
    Replies: 8
    Last Post: 07-22-2003, 07:50 PM
  5. Help System
    By Bill Griffin in forum Alpha Five Version 5
    Replies: 1
    Last Post: 01-18-2003, 07:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •