Alpha Video Training
Results 1 to 26 of 26

Thread: How to change absolute IFR to relative?

  1. #1
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default How to change absolute IFR to relative?

    Designing a new table for a database that is installed on different logical drives on different systems under different Windows versions. This works on the main system. E:\A5V8\Archives\2011 badges\Hiker.bmp. How can I adjust it for other computers?

    Th following works on a different table, but there is no formula (hopefully) for the IFR in the new table. OTOH the new table is small and only I will be entering data - probably.

    ImageFilename = a5_eval_expression("=a5.get_path() + chr(92) + \"Photos\" + chr(92) + trim(Imgname)+\".jpg\"",local_variables())

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    I'm not sure what the question is. Are you looking for image_filename_encode()?

  3. #3
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Not the first time I am bitten by anticipating disasters. There is no problem after all!

    I wrote the table with E:\ references and copied to different system - where it just plain worked. The IFR properties on one system reads E:\A5V8\Archives\2011 badges\Hiker.bmp, but on the other it reads D:\A5V8\Archives\2011 badges\Hiker.bmp.

    Who woulda thunk it?

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default Re: How to change absolute IFR to relative?

    Sandy, presumably you're talking about Image Reference Fields, right ?

  5. #5
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Oh dear. What an embarrassing place for a typo! Yes, indeed, that should have been IRF.

  6. #6
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default Re: How to change absolute IFR to relative?

    Hi, Sandy,

    When I first saw your subject line I thought you were talking about Instrument Flight Rules. Couldn't resist teasing you a bit. Sorry 'bout that. -- tom

  7. #7
    "Certified" Alphaholic Tim Kiebert's Avatar
    Real Name
    Tim Kiebert
    Join Date
    Jul 2004
    Location
    Geelong, Victoria, Australia
    Posts
    2,785

    Default Re: How to change absolute IFR to relative?

    Tom, you are a bad man. :-)
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

  8. #8
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    I would have abbreviated it as IFR as well. In the docs for field types they are

    Image File Reference

  9. #9
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,311

    Default Re: How to change absolute IFR to relative?

    Goes to show that using an acronym injects a tad bit of ambiguity. Some of us (me especially) are more easily confused than others.

    Image File Reference
    Image Reference Field

    Both terms are used in the helps.

    -- tom

  10. #10
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Since you guys were silly enough to yank my chain, here's another. I would like to be able to edit the BMP the form shows. That could happen from a command prompt of

    "D:\Program Files\IrfanView\i_view32.exe" "E:\A5V8\Archives\2011 badges\camper.bmp"

    where Alpha thinks the parameter is recg2011->PIC and PIC is defined as an Image File Reference. IOW is it possible to translate A5speak to DOSspeak on the fly

  11. #11
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    If i_view32.exe is the registered program to open/edit bitmap files all you need is

    sys_open("E:\A5V8\Archives\2011 badges\camper.bmp")

    If not

    sys_shell("D:\Program Files\IrfanView\i_view32.exe E:\A5V8\Archives\2011 badges\camper.bmp")

    If you are asking about passing the pic field value to these

    pic = "E:\A5V8\Archives\2011 badges\camper.bmp "
    sys_open(alltrim(pic))
    Last edited by Stan Mathews; 05-09-2012 at 04:12 PM.

  12. #12
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    The impossible just takes a bit longer ;-)

    sys_open(alltrim(pic)) should work if only it said sys_open(alltrim(filename in the PIC field of the table upon which this form is based where PIC is an Image Reference Field)). The relative path is a5.get_path() + chr(92) + "2011" + chr(92) and the field is recg2011->PIC

    E:\A5V8\Archives\2011 badges\camper.bmp does work from the OS commandline.

  13. #13
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Just close enough to be tantalizing.

    fld = tbl.field_get("badgepix")
    target = fld.value_get()

    returns =filename_decode("alarm.bmp")

    for the record with the Image Reference Field badgepix value of alarm.bmp. How do I get rid of the

    =filename_decode()

    part, or avoid it in the first place, so the script can say

    a5.get_path() + chr(92)+"decoded name for this record"

  14. #14
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    I seem to be within one character of a solution.

    sys_open ("D:\Users\sbg\Desktop\xrcise\alarm.bmp") works to open a given file.

    where=chr(40)+a5.get_path() + chr(92)+target2
    ui_msg_box("Information 2", where)

    shows (D:\Users\sbg\Desktop\xrcise\"alarm.bmp")
    How do I get rid of one quotation mark and add another so we can use sys_open (where) ?

  15. #15
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    Where are you getting target2?

  16. #16
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    tbl = table.current()
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    target2=ltrim((target), "=filename_decode(")

    Badgepix is an image field reference. Could be BMP or JPG. I want A5 to tell Windows to open the graphic.

  17. #17
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    This works here.

    Code:
    tbl = table.open("tbl_dummy")
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    ? target
    = =filename_decode("\WINDOWS\Greenstone.bmp")
    
    ? file.filename_parse(target,"NE")
    = "Greenstone.bmp"
    sys_open(file.filename_parse(target,"NE"))
    Opens the bitmap file.

  18. #18
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Stranger and stranger. I get different kinds of data depending on which directory the graphic is in. So I moved the sample to a subdirectory of the ADB, where the real thing will be.
    Code:
    tbl = table.open("practice")
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    ? target
    = =filename_decode("[exe_folder]\Xrcise\Pix\alarm.bmp")
    ? file.filename_parse(target,"NE")
    = alarm.bmp")
    This looks like it should work - but it doesn't
    Code:
    sys_open((chr(40) + chr(34) + a5.get_path() + "\\"+"pix"+ "\\" + file.filename_parse(target,"NE")))

  19. #19
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    This works here.

    Code:
    tbl = table.open("practice")
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    ? target
    = =filename_decode("[app_path]\Pix\alarm.bmp")
    
    ? file.filename_parse(target,"NE")
    = "alarm.bmp"
    
    sys_open(file.filename_parse(target,"NE"))
    If your image directory is under the application directory you don't need the complete path. Alpha looks there first.
    Last edited by Stan Mathews; 05-16-2012 at 01:25 PM.

  20. #20
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Oh dear. I can't figure why you get app_path while I get exe_folder, but that shouldn't matter. The difference between "alarm.bmp" and alarm.bmp is more disconcerting. But how does your Windows know where to find the bmp file, especially since there could be more than one subdirectory?

  21. #21
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    It is not Windows that knows where to find the file, Alpha does via the Image File Reference field. That's what it's all about. A file reference to an image. After creating two new directories and moving the pic folder down two levels, and resetting the IFR field to the new location ..... (still under the application directory).

    Code:
    tbl = table.open("practice")
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    ? target
    = =filename_decode("[app_path]\gobbledy\gook\Pix\alarm.bmp")
    
    ? file.filename_parse(target,"NE")
    = "alarm.bmp"
    
    
    sys_open(file.filename_parse(target,"NE"))

  22. #22
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    A total mystery. Might this be a difference between version 8 and later? Windows 7 and earlier?

    Code:
    tbl = table.open("practice")
    fld = tbl.field_get("Badgepix")
    target = fld.value_get()
    ? file.filename_parse(target,"NE")
    = alarm.bmp")
    sys_open(file.filename_parse(target,"NE"))
    ' no joy
    sys_open("E:\xrcise\Pix\alarm.bmp")
    ' opens alarm.bmp in iview

  23. #23
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    It does behave differently under V8.

    Try

    Code:
    sys_open(file.filename_parse(strtran(file.filename_parse(target,"NE"),chr(34)+")",""),"NE"))

  24. #24
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    sys_open(file.filename_parse(strtran(file.filename_parse(target,"NE"),chr(34)+")",""),"NE"))

    Works!!! It will take me three days to figure why and how, but it does work. Many thanks.

  25. #25
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change absolute IFR to relative?

    I got wound up too tight somewhere in there. All you need is

    sys_open(strtran(file.filename_parse(target,"NE"),chr(34)+")"))

  26. #26
    Member
    Real Name
    sandy garrett
    Join Date
    Apr 2000
    Location
    Near Philadelphia
    Posts
    571

    Default Re: How to change absolute IFR to relative?

    Actually sometimes I need

    dim photo2dir as C = a5.get_path() + chr(92) + "2011 Badges" + chr(92)

    So I just used sys_open(photo2dir+strtran(file.filename_parse(target,"NE"),chr(34)+")"))

    Which always works. Now we can carry pix around on the netbooks and can blow them up to see the minutia with a single click!

Similar Threads

  1. Is there a way to filter on an IFR field?
    By Sandy Garrett in forum Alpha Five Version 8
    Replies: 2
    Last Post: 09-18-2011, 01:25 PM
  2. Why use IFR?
    By Steve Wood in forum Application Server Version 10 - Web/Browser Applications
    Replies: 14
    Last Post: 04-03-2011, 09:05 PM
  3. IFR on Reports from SQL
    By jonathank in forum Application Server Version 10 - Web/Browser Applications
    Replies: 1
    Last Post: 03-21-2010, 12:19 AM
  4. formatting absolute time values from a character field
    By trackmanpete in forum Alpha Five Version 8
    Replies: 7
    Last Post: 03-16-2007, 10:07 AM
  5. Inspect Memo or Image field code (absolute selected)?
    By Amanita in forum Alpha Five Version 6
    Replies: 3
    Last Post: 11-30-2005, 01:29 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
  •