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

Find from list

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

  • Find from list

    Hi All,

    I want to find (1) number of occurs (2) If number of occurs is more than 2 then I need the "path" values from list as this samples.
    I used the Word_occurs() for finding the Number of Records.

    I am trying to append the invoices by same job name,
    as like pdf_append(Invoices_1329.pdf , Invoices_1351.pdf, one_pdf_file ).
    I have trouble to find the "Path (example; Invoices_1329.pdf and Invoices_1351.pdf)" from my list.

    Code:
    'The folder List files, after created the PDF files
    vfolder=<<%list%
    Y:\shareData\Invoices\Group by Job\UMMC Shock Trauma\Invoices_1329.pdf
    Y:\shareData\Invoices\Group by Job\UMMC Shock Trauma\Invoices_1351.pdf
    Y:\shareData\Invoices\Group by Job\UM Bookstore\Invoices_1278.pdf
    Y:\shareData\Invoices\Group by Job\UM Bookstore\Invoices_1800.pdf
    Y:\shareData\Invoices\Group by Job\UMB Terrace\Invoices_1093.pdf
    Y:\shareData\Invoices\Group by Job\NASM Renovations PH 2\Invoices_1333.pdf
    %list%
    
    vfolder = alltrim(vfolder)
    nFolder = *count(vFolder)
    vTrimFolder=""
    for each foo in vfolder
    	'get the job name only and subtract with job name
    	vTrimfolder = vtrimfolder + alltrim(word(foo.value,5,chr(92)))+crlf() 
    next
    
    vPostfolder = *remove_duplicates(alltrim(vTrimFolder))
    
    'How to find the number of occur from the list?
    nLine=0
    for each x  in vPostFolder
    	nFound = word_occurs(alltrim(vTrimFolder),alltrim(x.value),crlf())  'vTrimFolder - work
    		
    	If nFound = 1
    '               'It works fine when nFound = 1 case
    		'show the pdf file
    		nLine = word_number_get(vTrimFolder,alltrim(x.value),crlf())
    		'msgbox("Numb of found ","Found "+str(nfound)+" line as  "+str(nLine) )
    		vViewFilePath = alltrim(word(vFolder,nLine,crlf()))	
     
    '		if file.exists(vViewFilePath) then 
    '			sys_open(vViewFilePath)
    '		else
    '			ui_msg_box("Error Opening File","File "+vViewFilePath +  "does not exist.",ui_stop_symbol)
    '		end if 					
    	else if nFound > 1
    		'How can I get the nTh Line number			
    		for i = 1 to nfound
    			[COLOR="#FF0000"][B]nLine = word_number_get(vTrimFolder,alltrim(x.value),crlf())  'I can find only one[/B][/COLOR]
    			msgbox("Numb of found 2","Found "+str(nfound)+" line as  "+str(nLine) )	
    			vViewFilePath = alltrim(word(vFolder,nLine,crlf()))	
    		
    		next i	
                    'Append here
                    'pdf_append(vPage1,vPage2,vSavePdffile)
            end if
    I also tried with an Array but I have no idea what to do next.
    Code:
    vfolder = alltrim(vfolder)
    
    
    'create an array
    nCount = *count(vFolder)
    dim a_folderList[nCount] as p
    're-arrange the list, path + jobname+inv_name
    cWord =""
    for i = 1 to nCount
    	cWord = word(vFolder,i,crlf())
    	a_folderList[i].path = word(cWord,1,chr(92))+chr(92)+word(cWord,2,chr(92))+chr(92)+word(cWord,3,chr(92))+chr(92)+word(cWord,4,chr(92))+chr(92)
    	a_folderList[i].jobnm = word(cWord,5,chr(92))+chr(92)
    	a_folderList[i].invNm = word(cWord,6,chr(92))
    next
    showvar(a_folderList[6].path,"test array list")
    
    [COLOR="#FF0000"][B][COLOR="#FF0000"][B]'How to find the Number of occurs with this array?[/B][/COLOR][/B][/COLOR]

  • #2
    Re: Find from list

    Word_number_get() will only ever return the first occurrence so it is not appropriate to what you are doing in the multiple occurrence case.


    for qx = 1 to nfound
    if x.value $ word(vFolder,nfound,crlf())
    vViewFilePath = alltrim(word(vFolder,nfound,crlf()))
    sys_open(vViewFilePath)
    end if
    next qx
    There can be only one.

    Comment


    • #3
      Re: Find from list

      You could do something like this.

      Given the list..........


      lst
      = Joe 123
      Bill 456
      Bob 123
      William 789
      Tom 666
      Mike 321

      'find the word number desired
      qv = WORD_NUMBER_GET(lst,"123",crlf())
      = 1
      ' do something with the #1 entry

      'remove the #1 entry from the list
      lst = word_subtract(lst,word(lst,qv,crlf()),crlf())

      'list now contains
      lst
      = Bill 456
      Bob 123
      William 789
      Tom 666
      Mike 321

      qv = WORD_NUMBER_GET(lst,"123",crlf())
      = 2
      'do something with the second entry
      There can be only one.

      Comment


      • #4
        Re: Find from list

        Thank you, Stan.

        I came out this. I could not able to make this until you gave me the subtract idea.

        Code:
        if nFound >= 2
        	nCycle = 0
        	if nFound>=11 then
        	    msgbox("Error","Found Too many Records ")
        	end if
        		
        	If inlist2(str(nFound),"2,4,6,8,10") then
        	    for i = 1 to nFound
        			nCycle = nLine+i-1  'Base on subsort, The Next one must be as following, #3+1(i)-1 = 3, #3+2(i)-1 = 5
        			vMultyFolder = vMultyFolder+word(vFolder,nCycle,crlf())+crlf()  
        	    next i			    
        	    'Append here
        
        	else
        	    msgbox("odd number")    
        	    'Append here
        	end if
        end if		
               'show the Pdf file
        	if file.exists(vViewFilePath) then 
        		sys_open(vViewFilePath)
        	else
        		ui_msg_box("Error Opening File","File "+vViewFilePath +  "does not exist.",ui_stop_symbol)
        	end if
        I tested up to 2 records and works fine. Thank you again.


        PDF_Append Code here and I have another question here. How can I make it as Dynamic(?) way?
        So I do not have to write for all the 10th cases.

        Code:
        		select
        		    case nFound = 2
        		    	vPage1 = word(vMultyFolder,1,crlf())
        		    	vPage2 = word(vMultyFolder,2,crlf())
        		    	vViewFilePath = substr(vPage2,1,at(chr(92),vPage2,5))+"Combine1.pdf"
        		    	pdf_append(vPage1,vPage2,vViewFilePath)
        
        		    case nFound = 4
        		    	vPage1 = word(vMultyFolder,1,crlf())
        		    	vPage2 = word(vMultyFolder,2,crlf())
        		    	vPage3 = word(vMultyFolder,3,crlf())
        		    	vPage4 = word(vMultyFolder,4,crlf())			    	
        		    	vViewFilePath1 = substr(vPage2,1,at(chr(92),vPage2,5))+"Combine1.pdf"
        		    	'pdf_append(vPage1,vPage2,vViewFilePath1)
        
        		    	vViewFilePath2 = substr(vPage2,1,at(chr(92),vPage2,5))+"Combine2.pdf"
        		    	'pdf_append(vPage3,vPage4,vViewFilePath2)	
        		    	
        		    	[COLOR="#FF0000"]'Can I do this?
                                vViewFilePath = substr(vPage2,1,at(chr(92),vPage2,5))+"Combine1.pdf"
        
        		    	'pdf_append(vPage1,vPage2 + vPage3 + vPage4, vViewFilePath)
        		    	
        		    	'or
        		    	
        		    	'pdf_append(vPage1, vAll=<<%All%
        		    	'vPage2
        		    	'vPage3
        		    	'vPage4
        		    	'%all%
        		    	' ,vViewFilePath )
        		    	
        		    	
        		    	'pdf_append(vViewFilePath1,vViewFilePath2,vViewFilePath)[/COLOR]		    	
        		    case nFound = 6
        		    	'...
        
        		end select

        Comment


        • #5
          Re: Find from list

          Why would you ask that? The documentation says pdf_append() takes two separate file names and an optional output file name. Why would you think you can supply four names as one?

          You don't need the separate case statements.

          if nfound > 0
          for qz = 1 to nfound
          eval("vpage"+alltrim(str(qz))) = word(vMultyFolder,qz,crlf())
          next qz


          then

          for qm = 2 to qz
          pdf_append(vpage1,eval("vpage"+alltrim(str(qm))))
          next qm
          There can be only one.

          Comment


          • #6
            Re: Find from list


            Thank you

            Comment


            • #7
              Re: Find from list

              Try this. I can't test it so i don't know if there are errors.

              Code:
                       	dim vpath as C
              	    	if mod(nFound,2)=0
              	    		vpath=substr(word(vMultyFolder,2,crlf()),1,at(chr(92),word(vMultyFolder,2,crlf()),5))
              	    		
              	    		for ax = 1 to nFound
              	    			eval("vPage"+(""+ix))=word(vMultiFolder,ax,crlf())
              	    			eval("vViewFilePath"+ax)= eval(vpath+"Combine"+ax+".pdf")
              	    		next
              	    		
              	    		for bx= 2 to nFound step 2
              				pdf_append(eval("vPage"+(""+(bx-1))),eval("vPage"+(""+bx)),eval("vViewFilePath"+(""+(bx/2)))
              			next
              	    	end if
              later: gosh, I guess that about the same thing Stan wrote but with more words.
              Last edited by john michaels; 04-04-2014, 11:19 AM.
              John Michaels
              "The only thing needed for evil to flourish is for good men to do nothing" - great quote but probably not Sir Edmund Burke

              Comment

              Working...
              X