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

Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

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

    #16
    Re: Is there A Way To Copy Reacords To A New table On Users PC and Run Queries From There?

    No need to.
    It has only six methods http://wiki.alphasoftware.com/StringDictionary

    Comment


      #17
      Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

      Edit: Here is the working function
      Code:
      FUNCTION SD_Var AS C (sdvar AS C, tname AS C, fldname AS C, fldvalue AS C)
      'DESCRIPTION: Creates a global StringDictionary var and populates with field data from table
      'all parameters are required 
      'Ex1 SD_Var("sd_setup","Machs","Machno","Setup") 
      '	Result from IW:
      '	?sd_setup.get("01")
      '	= "Jersey"
      'Ex2 using an expression for fldvalue: 
      '	txt = "alltrim(t.cut)+chr(46)+remspecial(t.size)" 'removes the inches symbol (30") from the field
      '	SD_Var("sd_cutsize","Machs","Machno",txt)	
      '	Result from IW:
      '	?sd_cutsize.get("01")
      '	= "22.30"
      
      	evaluate_template("dim global "+sdvar+" as stringdictionary")
      	evaluate_template(sdvar+".clear()")	
      	dim t as p	
      	dim cmd as c
      	dim lst as c	
      	dim newvalue as c
      	dim txt as c	
      	dim fldflag as L = .f.
      	
      	on error goto ERRMSG
      	t = table.open(tname)
      	'test if fldvalue is a field name
      	lst = t.field_name_get()
      	fldflag = word_exists(lst,fldvalue,crlf())
      	
      	if fldflag then	
      		'uses a field name	
      		txt = "t."+var->fldvalue
      		cmd = convert_expression(sdvar+".Set(t."+fldname+",t."+fldvalue+")","V")
      		'Traceln("txt field",txt)
      		'Traceln("cmd expression",cmd)					
      	else
      		'uses an expression
      		txt = fldvalue
      		'Traceln("txt expression",txt)		
      	end if
      	
      	t.fetch_first()											
      	while .not. t.fetch_eof()
      		if fldflag then		
      			evaluate_template(cmd)
                              newvalue = eval(txt)			
      		else
      			newvalue = eval(txt)			
      			evaluate_template(sdvar+".Set(t."+fldname+","+quote(newvalue)+")")
      		end if
                       'Traceln("newvalue",newvalue)
      		t.fetch_next()
      	end while
      	
      	CLOSEIT:
      	t.close()		
      	SD_Var = txt
      	end
      	ERRMSG: 
      	'commit_flag = .f.
      	'script_play("ERRMSG")
      	on error goto 0
      	RESUME CLOSEIT
      END FUNCTION
      Last edited by MoGrace; 01-01-2016, 01:55 PM. Reason: Posted working function
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #18
        Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

        Maybe take out the stringdictionary element and get your strings checked using
        debug()
        traceline() etc

        Comment


          #19
          Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

          Where to put the condition to test if fldvalue was a field value or an expression was my trouble - got it fixed, in case anyone is interested.

          SD_Var_20160101.txt

          Happy New Year!
          Robin

          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

          Comment


            #20
            Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

            Robin,
            it would asier to understand if you explain the circumstance and objective and what was the hurdle you overcame.?

            Is objective that the result of a match may possibly be text or else a piece of code to execute?

            Comment


              #21
              Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

              Robin,
              it would easier to understand if you explain the circumstance and objective and what was the hurdle you overcame.?

              Is objective that the result of a match may possibly be text or else a piece of code to execute?

              Comment


                #22
                Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                The objective was to have a function I could use in the Autoexec to populate one or more global vars dimmed as StringDictionary. I use natural and primary keys extensively in my apps and both are needed for set links, lookups, etc. I know it seems I have overtaken Nigel's post, but it was his query and your solution that gave me the idea of how to get these matching values quickly without having to open a table.

                An example would be that whenever the user must input a customer ID into a record, he can enter the natural key like "Fairway" to get "D0088", the primary key filled in automatically.

                The hurdle was to have this function take an expression where two or more values could be used to get the needed value. With this function the list needn't be 'static' in the sense that its list can be updated on the fly - as in Nigel's scenario where the product list is constantly being updated. The function seems very fast though I haven't tested it on a truly large table.
                Last edited by MoGrace; 01-02-2016, 11:33 AM.
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                  #23
                  Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                  Be careful with StringDictionary the keys are not case sensitive so abc, Abc, aBc, abC, ABC are all the same key!

                  Comment


                    #24
                    Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                    Hi Guys, I totally appreciate all the responses so far, I'm struggling to understand them all.

                    One thing that I have done so far (because Ray pointed out its a time hog), I removed the containsi(upc_multi,Var->Product_Lookup) from the long query list where I had it, I placed it in a secondary query that runs only when the 1st query doesn't find any match.

                    As for Robin's suggestion to edit the filter in my set structure to omit some records, I do have a set for the Product_Lookup table, but products.dbf is the only table in it. So I don't have an option to include a filter, Should I redesign the set and make Products a child table so I can include a filter?

                    Correct Ray, I do have a catchall for all circumstances for the cashier, the secondary query where I moved the Multi_UPC to, was always there, but it use to check only the name of the product, so if the cashier was to type "Corned Beef", they would get a list of all brands and sizes of corned beef to choose the desired one from. If I made it so that the cashier have to start specify where to search, I would solve one problem while creating another, I need it as effortlessly as possibly for them, one search box that does it all.

                    Pardon me for asking what seems to be common knowledge, but, what is "string dictionaries", I couldn't find that in the documentation.

                    Comment


                      #25
                      Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                      Try a search for "StringDictionary" as one word.

                      Nigel, can you post a screenshot of the lookup form you are using?
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                        #26
                        Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                        Nigel
                        Your scan should be the primary test.
                        Use the code in post 14 at the bottom starting
                        ---- all upc numbers will be allocated to an item -----------
                        It was written for you. It is tested and working. Uses fields UPC, UPC_MULTI and ITEM_NUM. You no longer search the field UPC_Multi , a complete list of all barcodes exist in a global variable called sdupc. You can't view it but is contains a list of every UPC number in your table with the ITEM_NUM, viewed with sdupc.get().
                        Replace my table name "product" to yours. Save it as a script. run it.
                        Once run and anytime thereafter in the session you have instant access to any UPC scan - Using these two lines to to see if it is a scan. check it will instantly return if successful and the ITEM_NUM
                        Test a scan in the IW to see the ITEM_NUM.
                        Code:
                        dim local cscan as c
                        cScan = "900096676"  'your_scan_number, 
                        ? sdupc.exists(cScan )
                        ? sdupc.get(cScan)
                        Last edited by Ray in Capetown; 01-03-2016, 01:49 PM.

                        Comment


                          #27
                          Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                          Originally posted by Allen Klimeck View Post
                          Be careful with StringDictionary the keys are not case sensitive so abc, Abc, aBc, abC, ABC are all the same key!
                          One would expect so, as with unique field values in a table.
                          Last edited by Ray in Capetown; 01-03-2016, 02:03 AM.

                          Comment


                            #28
                            Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                            OK Robin, Here is a screen shot of my Product lookup form after searching for the word "Meat"
                            Product_Lookup Form.jpg

                            OK Ray, I think I understand now what a String Dictionary is, and it does seem very promising indeed.

                            As instructed, I Created a script and save it. I named it "POS_ProductLookup"
                            I corrected the table name. So, it now looks like this:

                            delete sdupc
                            dim global sdupc as StringDictionary
                            pro=table.open("products") 'substitute your table name
                            pro.fetch_first()
                            while .not. pro.fetch_eof()
                            if pro.UPC>""
                            sdgl.set(pro.UPC, pro.ITEM_NUM) 'the default upc
                            end if
                            if pro.UPC_MULTI>"" ' MULTU UPC
                            upm=stritran(pro.UPC_MULTI,",",crlf()) 'assuming the barcodes are comma separated
                            for each foo in upm
                            sdgl.set(foo.value, pro.ITEM_NUM) 'to allocate each to the same item
                            next
                            end if
                            pro.fetch_next()
                            end while



                            I don't understand this part from post 14:

                            if sdupc.Exists(cScanstr)
                            idtofind using the index= sdupc.Get(cScanstr)


                            And in general I don't quite get how to implement it into my software.
                            Last edited by nigeldude; 01-03-2016, 10:57 PM.

                            Comment


                              #29
                              Re: Is there A Way To Copy Records To A New table On Users PC and Run Queries From There?

                              Did you run it, had no error?
                              Then in the IW type
                              (as if user user enters "0244")

                              Code:
                              ?sdupc.Exists("0244")
                              =.t.
                              ? sdupc.Get("0244")
                              ="00000244"
                              and see how long it took to return the ITEM NUMBER from a UPC number
                              To find the record using fetch_find;
                              suppose tbp is your pointer to the table , "enterstr" is the user entry string
                              Code:
                              indx = tbp.index_primary_put("ITEM_NUM")
                              if sdupc.Exists("enterstr")
                                    recf=tbp.fetch_find(sdupc.Get("enterstr"))
                              else
                                    recf=tbp.fetch_find("enterstr")
                              end if
                              if recf>1 ' tbp is pointing to the record you want to use to populate the checkout item record .
                                  'success,  populate the sales item record
                              else
                                  'you will immediately know to do your general search
                              end if

                              Comment

                              Working...
                              X