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

Lookupd()

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

    Lookupd()

    Hi, have looked at threads regarding lookups, didn't find what I needed. Have a talbe "receivble.dbf", two of the fields are, companyid, due_date. I am tryint to put a simple exp in data entry, on the due_date field. Exp is "date+LOOKUPD("f",companyid,"terms","company.dbf","company1") result is "does not evual to date value", going wrong here somewhere. Basically I need the due_date to be the entry date plus whatever the terms are for the cust. Ant suggs. tks jb

    #2
    Re: Lookupd()

    Did you mean to use

    "date()+LOOKUPN("f",companyid,"terms","company.dbf","company1")

    You match the lookup type to the value you are returning.
    There can be only one.

    Comment


      #3
      Re: Lookupd()

      John, leaving aside the typos in your post, are you trying to add a number to the present system date to determine when something (a payment, perhaps) should be due?
      If so, shouldn't you be looking up a "number", and not a "date". Lookupd() will return a date, not a number. Don't you need a number? i.e. shouldn't you be using LOOKUPN() ?

      Comment


        #4
        Re: Lookupd()

        sory forgot the zip

        Comment


          #5
          Re: Lookupd()

          Rather hard to see what you are trying to do without any data. Your terms field is character type.

          The lookupn() failed because we assumed your terms field was numeric.

          date() + 30 yields {06/05/2009}

          date()+"1% Net 30" yields "05/06/20091% Net 30"

          I think you need to reexamine what you exprect to happen.

          addendum: If you want to use the system date variable you must refer to it as system->date, not plain date.
          Last edited by Stan Mathews; 05-06-2009, 05:25 PM.
          There can be only one.

          Comment


            #6
            Re: Lookupd()

            Thank you Stan, changing the lookupN to lookupC, gave me the expression result of / /. However, when I go to save it, still says it doesn't evual to a date value. If I put system->date, in front of date, it gives me 06/05/2009, but still says is not a date value, Puzzled, thans for the patience. jb

            Comment


              #7
              Re: Lookupd()

              John, I think it would help if you wrote down the small steps you want Alpha Five to take so we can understand what it is you're trying to accomplish. How about explaining it in words, walking through the steps you want Alpha Five to take... like this:

              a) retrieve _______________ from the __________ table, using index ___________ and
              a search key of ______________

              b) "add" ____________ to the current system date

              c) store the resulting "date" in field ____________
              Last edited by Tom Cone Jr; 05-06-2009, 10:27 PM.

              Comment


                #8
                Re: Lookupd()

                Hi Tom, tks for trying here. Here goes, 1.. I need to look at the date field in the receiv table. 2.. then I need to lookup the companyid from the same table "receiv". The companyid looks up the cust.dbf and retreives the Terms for that customer. the index is company1. 3.. The result is stored in the due_date field. Right now I'm trying to use this expression.

                date+LOOKUPC("F",CompanyID,"TERMS","Cust.dbf","Company1", this gives me the result of / /, but doesn't save as a date value. tks Tom, jb . attached are the 2 tables involved.

                Comment


                  #9
                  Re: Lookupd()

                  John, I think what Stan and Tom are trying to point out here is for you to look at the data in each of the fields that you are using and try your expressions manually. For instance, are you trying to do your date calculations from todays date? If so, why are you looking up a date in a table. If your terms field has something in it like "1% Net 30" then what are you expecting if you add that character value to a date. When getting an error like you did you need to break things down into parts. The expression that you are trying to complete is to add a date to ?????? If you look at the docs, you add a numeric value to a date to get a resulting date. Your terms field is character. So that won't work. Now when you look at the values that you are going to have in your terms field, can they be evaluated as numerics. If not, then you need to rethink what you are doing and how to calculate it.

                  Comment


                    #10
                    Re: Lookupd()

                    Hi Doug,

                    What I think John is trying to do is calculate the date an invoice is due from todays date plus the number of days in the terms of the selected customer.

                    You are right that John has the terms field as character, so if you change it to numeric and enter 28, can you get the lookup to work?

                    This works for me, DATE()+LOOKUPN("F",Companyid,"Terms","cust","Cust_Id") result = 04/06/2009 where terms are 28.
                    Last edited by Keith Hubert; 05-07-2009, 02:50 AM.
                    Regards
                    Keith Hubert
                    Alpha Guild Member
                    London.
                    KHDB Management Systems
                    Skype = keith.hubert


                    For your day-to-day Needs, you Need an Alpha Database!

                    Comment


                      #11
                      Re: Lookupd()

                      John, the step by step explanation is a good start. I've taken a look at the tables you supplied. In the Cust table you gave us the "terms" field is blank. So we don't know what kind of data you would normally store there.

                      In the Receiv table the "date" field is blank in many of your sample records and is the same the remaining records.

                      Please re-write your step by step sequence but include actual sample field values so we can see how you finally get to the result you are seeking.

                      It seems to me your narrative description skips a step or two. Retrieving a text string from the "terms" field will give you a text (character) result. You then say you want to put that result in the "due_date" field, but "due_date" cannot hold character data. Somewhere a step got skipped.

                      Please break this down into smaller, more numerous steps, using actual field names and sample field values, so we can get a grasp on what it is you're trying to do.

                      I know this seems tedious. But understanding the question is the key to finding the answer.

                      -- tom
                      Last edited by Tom Cone Jr; 05-07-2009, 07:13 AM.

                      Comment


                        #12
                        Re: Lookupd()

                        John,

                        I'm going to try to work back at this from your perspective/data.

                        1.. I need to look at the date field in the receiv table.
                        The second record is for companyid "00001", the date field holds 05/05/2009.

                        2.. then I need to lookup the companyid from the same table "receiv". The companyid looks up the company.dbf and retreives the Terms for that customer. the index is company1.
                        Currently there are no terms set in the company.dbf for companyid 00001. One of the items in the simple list lookup you have defined for the terms field is "Paid" and another is "1% Net 30".

                        Let's examine those two cases.

                        3.. The result is stored in the due_date field.
                        What should be stored in the due_date field for a transaction dated 05/05/2009 for companyid 00001 when the terms are "Paid". What should be the result of 05/05/2009 + "Paid" ?

                        What should be stored in the due_date field for a transaction dated 05/05/2009 for companyid 00001 when the terms are "1% Net 30". What should be the result of 05/05/2009 + "1% Net 30".

                        If you add a "days" field to the company.dbf, make it numeric, and define some "days", this works. (Make sure your company1 index has the expression companyid.)

                        Code:
                        DATE+LOOKUPN( "F", COMPANYID, "days", "COMPANY.DBF", "COMPANY1")
                        The reason your date field was confusing is that most here have become accustomed to not using Alpha function names as field names. Instead of "date" we might use "tdate", "transdate", "t_date", "trans_date", or something similar.
                        Last edited by Stan Mathews; 05-07-2009, 09:00 AM.
                        There can be only one.

                        Comment


                          #13
                          Re: Lookupd()

                          Thank you all for your input. I believe I tried to make a simple result into a complicated process. I changed the "terms" to a N value, thank you Keith, and the results are as required. Now I just have to add a discount field to handle the % discount based on how may days it takes to pay the Inv. Again thank you all. jb

                          Comment

                          Working...
                          X