Alpha Video Training
Results 1 to 3 of 3

Thread: Hopefully, an easy one...

  1. #1
    Member
    Real Name
    Larry F. Carraher
    Join Date
    Jul 2012
    Posts
    185

    Default Hopefully, an easy one...

    Good Day,

    I asked for an assist a few months ago about changing fonts in Alpha.

    STAN MATHEWS wrote the following script:

    ==================================================================

    tbl = table.open("itins",FILE_RW_EXCLUSIVE)
    tbl.fetch_first()
    while .not. tbl.fetch_eof()
    rtftext = *bin_to_rtf(tbl.memo) 'change 'rtfmem to your rtf memo field name
    newrtf= strtran(rtftext,"fs24","fs20") 'change font size 8 to 24 'set 16 and 48 to double actual standard size and double new desired size
    newbin = *rtf_to_bin(newrtf)
    tbl.change_begin()
    tbl.memo= newbin
    tbl.change_end()
    tbl.fetch_next()
    end while
    tbl.close()

    ==================================================================

    This works great, HOWEVER, the script is now taking quite a bit of time to run.
    I now would like to incorporate an existing GLOBAL variable, G_TRIP which is a Numeric 7.0
    variable and only perform the logic on those records.

    How can I filter to JUST the trip identified by the global variable ?

    Thank you...

    Lar

  2. #2
    Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,557

    Default Re: Hopefully, an easy one...

    Build a query operation that you can test to verify the appropriate records are retrieved.

    Then look at the xbasic code to see what needs to be incorporated into the script Stan provided.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Hopefully, an easy one...

    Along with only getting just the queried records, if you wrap the while..end while with batch_begin...batch_end it should speed up the processing.

    Code:
    tbl = table.open("itins",FILE_RW_EXCLUSIVE)
    tbl.fetch_first()
    tbl.batch_begin()
    while .not. tbl.fetch_eof()
    rtftext = *bin_to_rtf(tbl.memo) 'change 'rtfmem to your rtf memo field name
    newrtf= strtran(rtftext,"fs24","fs20") 'change font size 8 to 24 'set 16 and 48 to double actual standard size and double new desired size
    newbin = *rtf_to_bin(newrtf)
    tbl.change_begin()
    tbl.memo= newbin
    tbl.change_end()
    tbl.fetch_next()
    end while
    tbl,batch_end()
    tbl.close()
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




Similar Threads

  1. 2 Easy Questions (Easy for you guys)
    By puterguy53 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 1
    Last Post: 10-05-2009, 10:29 PM
  2. Easy one..
    By Wes Jones in forum QReportBuilder
    Replies: 5
    Last Post: 11-13-2008, 05:15 PM
  3. Easy One
    By Jim Lightburn in forum Alpha Five Version 5
    Replies: 7
    Last Post: 10-20-2004, 11:13 AM
  4. Easy to do... I am sure....
    By Adam Martin in forum Alpha Five Version 5
    Replies: 1
    Last Post: 01-22-2004, 03:39 PM
  5. i know its easy but.....
    By biber biber in forum Alpha Five Version 5
    Replies: 8
    Last Post: 11-28-2003, 08:51 AM

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
  •