Alpha DevCon 2018
Results 1 to 3 of 3

Thread: Code Issue

  1. #1
    Member
    Real Name
    Mark Willard
    Join Date
    Dec 2012
    Posts
    279

    Default Code Issue

    Hello:

    I have following code and following problem.

    What I am doing is enterning the image path in the image reference field.

    MY PROBLEM:
    When it finished it does not stay on the same record I was on. It put me on the new record. Is there anyway it can be avoided?


    Code:
    dim filename as C
    dim newfilename as C
    dim name_ext as C
    dim tbl as P
    filename = "J:\ALPHAFIVE\images\defaultptagimage.jpg"
    dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(Ptag_category.value)+"\\"+alltrim(ptag_sub_category.value)+"\\"+alltrim(vendor_code.value)+"\\"+alltrim(Family_cd.value))
    newfilename = "L:\PRODUCTIMAGES\\"+alltrim(ptag_category.value)+chr(92)+alltrim(ptag_sub_category.value)+chr(92)+alltrim(vendor_code.value)+chr(92)+alltrim(Family_cd.value)+chr(92)+id.value+"-"+trim(style.value)+"-"+trim(Family_cd.value)+"-DEFAULTIMAGE.jpg"
    file.copy(filename,newfilename)
    
    
    tbl = table.current(1)
    tbl.enter_begin(.t.)
    tbl.productnewimagelink = image_filename_encode(newfilename)
    tbl.enter_end(.t.)
    productnewimagelink.Refresh()
    Thanks.
    Mark

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

    Default Re: Code Issue

    Code:
    dim filename as C
    dim newfilename as C
    dim name_ext as C
    dim tbl as P
    dim tc1 as P
    filename = "J:\ALPHAFIVE\images\defaultptagimage.jpg"
    dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(Ptag_category.value)+"\\"+alltrim(ptag_sub_category.value)+"\\"+alltrim(vendor_code.value)+"\\"+alltrim(Family_cd.value))
    newfilename = "L:\PRODUCTIMAGES\\"+alltrim(ptag_category.value)+chr(92)+alltrim(ptag_sub_category.value)+chr(92)+alltrim(vendor_code.value)+chr(92)+alltrim(Family_cd.value)+chr(92)+id.value+"-"+trim(style.value)+"-"+trim(Family_cd.value)+"-DEFAULTIMAGE.jpg"
    file.copy(filename,newfilename)
    
    
    tbl = table.current(1)
    tc1 = tbl.get_cursor()
    tc1.enter_begin(.t.)
    tc1.productnewimagelink = image_filename_encode(newfilename)
    tc1.enter_end(.t.)
    productnewimagelink.Refresh()
    tc1.close()
    There can be only one.

  3. #3
    Member
    Real Name
    Mark Willard
    Join Date
    Dec 2012
    Posts
    279

    Default Re: Code Issue

    Still Same Issue:

    I would like to stay on the form. I am just updating a field while I am on the same row of the table. I think I am doing something wrong.

    Code:
    dim filename as C
    dim newfilename as C
    dim name_ext as C
    dim tbl as P
    dim tc1 as P
    filename = "J:\ALPHAFIVE\images\defaultptagimage.jpg"
    dir_create_recurse("L:\PRODUCTIMAGES\\"+alltrim(Ptag_category.value)+"\\"+alltrim(ptag_sub_category.value)+"\\"+alltrim(vendor_code.value)+"\\"+alltrim(Family_cd.value))
    newfilename = "L:\PRODUCTIMAGES\\"+alltrim(ptag_category.value)+chr(92)+alltrim(ptag_sub_category.value)+chr(92)+alltrim(vendor_code.value)+chr(92)+alltrim(Family_cd.value)+chr(92)+id.value+"-"+trim(style.value)+"-"+trim(Family_cd.value)+"-DEFAULTIMAGE.jpg"
    file.copy(filename,newfilename)
    
    
    tbl = table.current(1)
    tc1 = tbl.get_cursor()
    tc1.enter_begin(.t.)
    tc1.productnewimagelink = image_filename_encode(newfilename)
    tc1.enter_end(.t.)
    productnewimagelink.Refresh()
    tc1.close()
    Last edited by markbwillard; 01-31-2013 at 01:03 PM.

Similar Threads

  1. Backup Workspace Issue: Saving FileSystem Reports/Code.....
    By dionmccormick in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 12-07-2012, 04:53 PM
  2. HTML <canvas> issue with Tabbed UI Issue
    By wiremu in forum Application Server Version 11 - Web/Browser Applications
    Replies: 0
    Last Post: 05-24-2012, 12:58 AM
  3. v11 issue with button in embedded browse click event code
    By Mike Wilson in forum Alpha Five Version 11 - Desktop Applications
    Replies: 3
    Last Post: 03-08-2012, 11:47 AM
  4. How to convert .java class code to AlphaFive Xbasic code?
    By Suvarchala in forum Application Server Version 11 - Web/Browser Applications
    Replies: 4
    Last Post: 01-04-2012, 12:07 AM
  5. Why inline-javascript code fires before ajax callback UDF xbasic code?
    By eritovs in forum Application Server Version 10 - Web/Browser Applications
    Replies: 6
    Last Post: 10-29-2010, 07:46 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
  •