Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Strange Embedded Browse behaviour accessing table records from Xbasic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strange Embedded Browse behaviour accessing table records from Xbasic

    Hey Folks,

    I'm getting a really strange behaviour from an embedded browse on a form. I've attached a link to a video that shows the issue.

    I'm updating an old VB6/Access database. I'm stilling using the Access tables and getting to them via Linked tables. The form is based on a 1:Many set. The many side is displayed in the embedded browse.

    The embedded browse contains the text location of an image and I display the image as each record is clicked on.

    I print a report for the main information on the form, plus the images from the browse.

    Printing an image is a problem because the Alpha Image control needs an Image File Reference Field. But I have Access tables... so... I created Alpha DBF tables just for printing. In code, I open the DBF and Linked tables, select my records, and copy from the Linked table to the DBF table... then print.

    Doing this record copy, however, causes my embedded browse to go kinda funny... and I have no idea why. I'm hoping someone has run into this. The code I'm running to copy the records is below as well... it's quite straight forward... or so I think. The code copies the main record and then the images records. It's the images record copying that is causing the odd behaviour. I thought I could open the same table as the browse is based on, in code, and copy the records. I'm not changing them, but I am selecting them. I thought the code would be separated from the Form.

    Here's the video link... watch the Image # in the embedded browse... it changes. If I put in server refreshes it helps... but only sometimes. And sometimes... the records disappear altogether. If I click on the browse they'll return. Thanks so much for looking.

    http://screencast.com/t/c6toab9w

    and here's the code I run...

    Code:
    'First... save record in current form at parent level.
    topparent.commit()
    
    'So... what report are we running?
    Dim reorderPrt as L
    reOrderPrt = .f.
    
    currRptFormat = Var->rptFormat
    if isNull(currRptFormat) then
    '	currRptFormat = "Photo Sheet - Main - 2 Images"
    	Msgbox("Digital Adjuster","Please select a Photo Sheet")
    	end 	
    end if
    
    dim filterstring as c 
    dim currCmpy as c
    filterstring = "RptName = " + s_quote(currRptFormat) 
    rptSelected = lookup("tblReportFormats",filterstring,"rptDesc")
    
    if isNull(rptSelected) then
    	Msgbox("Digital Adjuster","Photo Sheet not found")
    	end
    end if
    'ui_msg_box("Report", rptSelected)
    'end 
    
    
    
    'Clear the temporary Print DBF tables
    query.filter = ""
    query.order = ""
    Dim currClmNbr as C
    
    currClmNbr = :frmClaims:claimnbr.text
    
    DIM operation_name as c
    operation_name = "qry_DelPrtClaims"
    If operation_name <> "" then 
    	mark.run_silent(operation_name,query.filter)
    End if
    
    query.filter = ""
    query.order = ""
    
    operation_name = "qry_DelPrtClaimImages"
    If operation_name <> "" then 
    	mark.run_silent(operation_name,query.filter)
    End if
    
    'Now... copy over the current Claim
    t = table.open("tblClaims")
    tidx = t.order("","Claimnbr = '" + currClmNbr + "'")
    if tidx.records_get() > 0 then
    	t.fetch_first()
    	t2 = table.open("prt_tblclaims")
    	while .not. t.fetch_eof()
    		record_data = t.record_data_get()
    		t2.enter_begin()
    		t2.record_data_set(record_data)
    		t2.enter_end(.T.)
    		t.fetch_next()
    	End While
    	t2.close()
    else
    	end
    End if
    tidx.drop()
    t.close()
    
    'Now... copy over the current Claim Images
    'But... we need to copy and rotate the original images
    'ImagePrtNbr
    
    
    Dim fnout as C
    Dim currFN as C
    Dim currPath as C
    Dim currFileName as C
    Dim imgCnt as N
    
    t = table.open("tblClaimImages")
    imgCnt = 1
    
    currPath = a5.Get_Path()
    
    tidx = t.order("ImagePrtNbr","Clmnbr = '" + currClmNbr + "' .AND. ImagePrt = .t.")
    
    if tidx.records_get() > 0 then
    	t.fetch_first()
    	t2 = table.open("prt_tblclaimimages")
    	while .not. t.fetch_eof()
    		If imgCnt = 5 then
    			imgCnt = 1
    		end if			
    			
    		currFT = file.filename_parse(t.ImageLoc, "e")
    		currFN = t.ImageNbr + currFT
    		fnout = currPath + "\Print_Images\\" + currFN
    		If t.ImageRotate = 0 then
    			nbrRotate = 0
    		else
    			nbrRotate = t.ImageRotate			
    		end if
    		IMRotate = "-rotate " + nbrRotate
    		currFileName = t.ImageLoc
    		pResult = a5_runImageMagicCommand(currFileName , fnout , IMRotate)	
    		
    		record_data = t.record_data_get()
    		t2.enter_begin()
    		t2.record_data_set(record_data)
    		'The Image File Reference field isnt' copying property... set it directly
    		t2.ImageLoc = fnout
    		t2.ImageName = t.ImageName
    		
    		'Because Alpha reports run in columns...we need to reorder the images to show in print properly... like a Z order
    		'msg = "This is ImagePrtNbr " + t.ImagePrtNbr
    		if reOrderPrt = .t. then
    			if imgCnt = 2 then
    				t2.ImageSeq = t.ImagePrtNbr + 1
    			else
    				if imgCnt = 3 then
    					t2.ImageSeq = t.ImagePrtNbr - 1
    				else
    					t2.ImageSeq = t.ImagePrtNbr
    				end if
    			end if	
    		else
    			t2.ImageSeq = t.ImagePrtNbr			
    		end if
    		
    		t2.enter_end(.T.)
    		t.fetch_next()
    		imgCnt = imgCnt + 1
    		
    	End While
    	t2.close()
    else
    	tidx.drop()
    	t.close()
    	end
    End if
    tidx.drop()
    t.close()
    'xbasic_wait_for_idle()
    :frmClaims:brs_claim_images.ServerSideRefreshAll()
    'topparent.ServerSideRefreshAll()
    'xbasic_wait_for_idle()
    
    'justreport:
    
    'PREVIEW_REPORT(useRpt, "", "", .t., .t.)
    PREVIEW_REPORT(rptSelected, "", "", .t., .t.)
    'xbasic_wait_for_idle()
    ':frmClaims:brs_claim_images.ServerSideRefreshAll()
    'topparent.ServerSideRefreshAll()
    
    Proc_Exit:
    	end 
    
    Proc_Err:
    	err = error_code_get()
    	msg = error_text_get(err)
    	ui_msg_box("Digital Adjuster", "Error # : " + err + " : " +  msg)
    	resume Proc_Exit

    #2
    Re: Strange Embedded Browse behaviour accessing table records from Xbasic

    In trying to correct this issue I had added ServerSideRefreshAll() to my code, before and after I ran the report. It seemed to correct it, but not always. I played with putting it in a various places... but it did not work.

    Here's the problem... the form is based on a set. The child table of the set, in Form properties, has a sort placed on a field. Then, in code, I would open the child table, select records... sort... and then process them. I wasn't changing anything, but I was selecting and sorting. Embedded browses do not like this. There's an option that Alpha provides... the "Lock order when editing" option on the child table, in Form properties. I did try this at one point, but having the ServerSideRefreshAll() in the code messed it up. Without the refresh the "Lock order when editing" seems to work... the embedded browse does not budge.

    So... Child table sort, ServerSideRefreshAll(), Lock order when editing, and selecting child records in code seem to mess up a browse. Try taking out the ServerSideRefreshAll() in these circumstances.

    Comment

    Working...
    X