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

Calculated field issue

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

    Calculated field issue

    I use a user entered field to produce a purchase order number. I am happy with the results but have a glitch. I use a default value based on a formula which is the vendor ID plus a " - " and then the julien date and I make it a unique field. This is working fine but my user is now having a problem with only being able to produce one purchase order for a particular vendor once a day. If I use a calculated field as described, can I add an increment letter like A for the first PO and B for the second in the formula?

    Here is my formula.
    ltrim(str(VENDOR_ID)+"-"+alltrim(str(jdate())))
    Jim Belanger

    #2
    Re: Calculated field issue

    You'd have to check for previous orders for the same vendor on the same day to tell what letter to use.

    Might be easier to add a time field to the purchase order table, populate it with "now()" as the order is created, and require that the purchase order and time field combination be unique.

    Try this... (substitute your actual tablename for "purchase_orders" and your actual fieldname for "po".


    Code:
    LTRIM(STR(VENDOR_ID)+"-"+ALLTRIM(STR(JDATE())))+"-"+CHR(65+TABLECOUNT("[COLOR="Red"]purchase_orders[/COLOR]","word([COLOR="red"]po[/COLOR],1,\"-\",2) = "+QUOTE(LTRIM(STR(VENDOR_ID)+"-"+ALLTRIM(STR(JDATE()))))))
    Last edited by Stan Mathews; 12-24-2008, 10:12 AM.
    There can be only one.

    Comment


      #3
      Re: Calculated field issue

      Originally posted by Beltronics View Post
      If I use a calculated field as described, can I add an increment letter like A for the first PO and B for the second in the formula?
      Yes, but first, let's simplify your expression:
      Code:
      dim vendor_ID as n=123
      ?ltrim(str(VENDOR_ID)+"-"+alltrim(str(jdate())))
      = "123-2454825"
      'Simplified:
      ?vendor_ID+"_"+jdate()
      = "123_2454825"
      To add letters is possible but involves more steps than you think:
      If a user enters an order, it will have "A" at the end. If he starts to add another, how is the system to know what was the last entery for that user? Was it nothing? or A? or B?
      So before adding a new record, you have to search if there were any entries by that user for this day. You could do that using dbmax(). Are you getting my point that this is unncessarily complicated.

      I can't see you insisting on doing this, but if you do, here is the expression:
      Code:
      ?vendor_ID+"_"+jdate()+"A"
      = "123_2454825A"
      
      ?increment_value(vendor_ID+"_"+jdate()+"A")
      = "123_2454825B"
      Perhaps a better way is to add the time of day instead of A, B...etc.
      Code:
      ?vendor_ID+"_"+time("MMddyyyy0h0mss",now())
      = "123_1224200807562626"

      Comment


        #4
        Re: Calculated field issue

        Thanks guys but, I can't see using these suggestions. I know the A B etc thing is way too complicated but the time suggestion makes the PO number way too long.

        Here's the problem that I am encountering and that you are not aware of. A simple auto increment number would be fine but my particular problem (self created) is that I create the PO number twice because field rules don't operate in "operations".

        When the operator decides to order parts, each part they select to order gets posted to an "order" table and that operation creates a PO number to post with the part. Then, when the selection process is done, (there are many parts in the "order" table with different PO numbers) the operator selects to "Create Purchase Orders" by clicking an action button. This invokes a report with an PO Header with a field rule creating the PO number again (based on the vendor and the julien date). This then selects all the parts in the "order" table with that PO number and groups them into purchase orders. So, I need to look in the Order table and pick out the unordered parts (I mark them when they have been ordered) and create a PO Header using the same PO number created in the ORDER table. So far, this works fine except when the operator wants to order twice from the same vendor on the same day.

        I have no special attachment to the way the PO number ends up looking. An auto increment from BELT90001 and on would be acceptable so any suggestions would be appreciated. If you guys had set up this system, I'm sure you would have chosen a different road but, I'm on the highway now and must keep driving forward.
        Jim Belanger

        Comment


          #5
          Re: Calculated field issue

          You already have your answer as to how to add A,B,C... to your ID.
          ID=increment_value(dbmax(....for key value use vendor_ID+"_"+jdate()...))

          Comment


            #6
            Re: Calculated field issue

            Thanks everyone but this one's beyond me. I'll restructure the ordering system with what knowledge I have. I just have to dig a new hole since I can't fill this one.
            Jim Belanger

            Comment

            Working...
            X