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

Formula Puzzle

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

    Formula Puzzle

    Hello, I work in a hospital and I have an Excel spreadsheet created for insulin drip calculations. I am a novice with Alpha 5 yet and I am having trouble converting the Excel calculations to work in Alpha. I will include what I have so far:
    Spreadsheet example:

    Accu- Glucose Basal Basal Proport. Tot Action
    Check Rate Rate
    Sequ. #
    1 490 0 0 9.75 8.0
    2 400 0.3 0.3 7.5 7.8
    3 300 0.5 0.5 5 5.5
    4 248 0.7 0.7 3.7 4.4
    5 95 0.5 0.5 -0.125 0.4
    6 110 0.5 0.5 0.25 0.8
    7 80 0.2 0.2 -0.5 0.0
    8 60 -0.8 0 -1 0.0 give 1amp D50
    9 100 0 0 0 0.0
    10 105 0 0 0.125 0.1
    11 140 0.1 0.1 1 1.1
    12 0.1 0.1 0 0.1
    13 0.1 0.1 0 0.1
    14 0.1 0.1 0 0.1
    15 0.1 0.1 0 0.1
    16 0.1 0.1 0 0.1
    Etc.
    All values are calculated off what the nurse types in the glucose column. Rows 12 and on have no data typed in therefore the values that you see.
    Now for the formulas that make the spread sheet work:

    Proportional Rate = IF(B2>0,0.025*(B2-100),0)

    Total Rate = IF(D2+E2>8,8,IF(D2+E20,IF(B3>349,D2+0.3,
    IF(B3>199,D2+0.2,
    IF(B3>129,D2+0.1,
    IF(B3>99,D2,
    IF(B3>89,D2-0.2,
    IF(B3>79,D2-0.3,
    IF(B3>68,D2-0.5,C2-1))))))),D2)

    Basal 2 = IF(C20,0.025*(GLUCOSE-100),0)

    Total Rate = IF(BASAL2+RATE>8,8,IF
    (BASAL2+RATE0,IF(GLUCOSE>349,BASAL2+0.3,IF(GLUCOSE>199,BASAL2+0.2,

    IF(GLUCOSE>129,BASAL2+0.1,IF(GLUCOSE>99,BASAL2,IF(GLUCOSE>89,BASAL2-0.2,

    IF(GLUCOSE>79,BASAL2-0.3,IF(GLUCOSE>68,BASAL2-0.5,BASAL-1))))))),BASAL2))

    I know this looks very complicated but if someone can print it off and look at it I'd appreciate it.
    I added the first part of this last formula recently to try and make it work: IF(GLUC_ID=0,0 but it still does not function.
    Thank you.
    Bill





    #2
    RE: Formula Puzzle

    What a mess that message became. The columns for the spreadsheet were smashed together. The first row of data should read like this:
    Accucheck Sequence # = 1
    Glucose = 490
    Basal = 0
    Basal = 0
    Proportional = 9.75
    Total Inuslin Rate (Units/hr) = 8.0
    Action = (nothing)
    Hope this helps.
    Thanks.

    Comment


      #3
      RE: Formula Puzzle

      Sort of hard to read due to the "unformatting" caused by cut and paste.

      Can you attach a small sample of the spreadsheet?
      There can be only one.

      Comment


        #4
        RE: Formula Puzzle

        Attached is the excel sheet with typical values filled in.

        Thanks for any ideas/help.

        Comment


          #5
          RE: Formula Puzzle

          What exactly is failing about the basal formula? Is it that the first basal calculation doesn't work out to be zero, or is it that all the calculated values are incorrect? What exactly does the alpha 5 field glucose_ID represent on the XCEL spreadsheet?

          I am a pharmacist and will try to help, but I'm not how everything in your alpha expression relates to what'
          s on the spreadsheet.

          Kind regards,
          Robin Sculthorpe

          Comment


            #6
            RE: Formula Puzzle

            Bill,

            It looks as if you've nested too many "If"'s together for A5. Excel is more tolerant. I believe the limit for A5 is 8 or 9, so in order for this to work, you'll have to break it down.

            Charlie

            Comment


              #7
              RE: Formula Puzzle

              Hi,

              If this is your expression,

              BASAL = IF(GLUC_ID=0,0,IF(GLUCOSE>0,IF(GLUCOSE>349,BASAL2+0.3,IF(GLUCOSE>199,BASAL2+0.2,

              IF(GLUCOSE>129,BASAL2+0.1,IF(GLUCOSE>99,BASAL2,IF(GLUCOSE>89,BASAL2-0.2,

              IF(GLUCOSE>79,BASAL2-0.3,IF(GLUCOSE>68,BASAL2-0.5,BASAL-1))))))),BASAL2))


              Then you are trying to calculate a value for Basal and you
              also have Basal as a field in the calculation. They would have to have different names, i.e. new_basal and prev_basal or something like that.

              Robin Sculthorpe

              Comment


                #8
                RE: Formula Puzzle

                Hi Robin,
                Yes, I have two basal fields (Basal and Basal2). I am trying to copy a spreadsheet created by one of our physicians. He wanted to keep the information in a database for further evaluation. I will include a copy of the Excel spreadsheet we use with common glucose values entered. Only the glucose number is plugged in by the nurse. The other cells in the spreadsheet are calculated from the glucose number and depend on how high that entered value is.
                Here are the fields I have created:
                1. Glucose (the number entered by the nurse)

                2. Basal - a calculated number field which must always have a value of zero for the first record and then follow the nested "IF" statement:
                IF(GLUC_ID=0,0,IF(GLUCOSE>0,IF(GLUCOSE>349,PREVIOUS('BASAL2')+0.3,IF(GLUCOSE>199,PREVIOUS('BASAL2')+0.2,IF(GLUCOSE>129,PREVIOUS('BASAL2')+0.1,IF(GLUCOSE>99,PREVIOUS('BASAL2'),IF(GLUCOSE>89,PREVIOUS('BASAL2')-0.2,IF(GLUCOSE>79,PREVIOUS('BASAL2')-0.3,IF(GLUCOSE>68,PREVIOUS('BASAL2')-0.5,BASAL-1))))))),PREVIOUS('BASAL2')))

                3. Basal2 - another calculated number field:
                IF(BASAL0,0.025*(GLUCOSE-100),0)

                5. Total Rate - another calculated number field:
                IF(BASAL2+RATE>8,8,IF(BASAL2+RATE0,IF(B3>349,D2+0.3,
                IF(B3>199,D2+0.2,
                IF(B3>129,D2+0.1,
                IF(B3>99,D2,
                IF(B3>89,D2-0.2,
                IF(B3>79,D2-0.3,
                IF(B3>68,D2-0.5,C2-1))))))),D2)
                Basal2:
                =IF(C20,0.025*(B2-100),0)
                Total Rate:
                =IF(D2+E2>8,8,IF(D2+E2

                Comment


                  #9
                  RE: Formula Puzzle

                  This is a proper puzzle that includes a fair whack of reverse engineering to discover the formulas used. As an exercise I took apart the first cel of the Spreadsheat.

                  There are actually 2 variables that are recursive. In other words Glucose determines a modification to the value of Basal1 based on the previous values of Basal2 unless Glucose is between 0 and 68.

                  If Glucose >349 then Basal1 = Prevbasal2 + 0.3
                  If Glucose >199 then Basal1 = Prevbasal2 + 0.2
                  IF Glucose >129 then Basal1 = Prevbasal2 + 0.1
                  IF Glucose >99 then Basal1 = Prevbasal2
                  If Glucose >89 then Basal1 = Prevbasal2 - 0.2
                  If Glucose >79 then Basal1 = Prevbasal2 - 0.3
                  If Glucose >68 then Basal1 = Prevbasal2 - 0.5
                  If Glucose is not greater than 68 then Basal1 = Prevbasal1 -1
                  if Glucose

                  Comment


                    #10
                    RE: Formula Puzzle

                    These might be better as a numeric value prompting a selection from an array.

                    Current Basal1 = PrevBasal2 plus a selection from {-0.5,-0.3,-0.2,0,0.1,0.2,0.3} for all glucose values greater than 68. Then deal with values not greater than 68 seperately.

                    I don't know how it would be done but it would be much neater than nested if statements.

                    Comment


                      #11
                      RE: Formula Puzzle

                      With that IF statement, a value over 349 would have the same number as all the others. I think you need to REVERSE the IF so that the lower values get evaluated first, then the higher values. This way, the IF will bail out at the first occurance of the number, if it is a low number, MAYBE the answer will be correct, otherwise, you can be sure that the answer will be wrong.

                      Tom

                      Comment


                        #12
                        RE: Formula Puzzle

                        an Example:

                        Basal = IF(B3>0,IF(B3>349,D2+0.3,
                        IF(B3>199,D2+0.2,
                        IF(B3>129,D2+0.1,
                        IF(B3>99,D2,
                        IF(B3>89,D2-0.2,
                        IF(B3>79,D2-0.3,
                        IF(B3>68,D2-0.5,C2-1))))))),D2)

                        if B3 > 349, then the 1st if will be true, AND ALL 6 of the others will also be true!!! so your answer will be D2-.05.

                        Switch it around

                        Basal = IF(b3>0,IF(B3>68,D2-.05,
                        IF(B3>79,D2-0.3,
                        IF(B3>89,D2-0.2,
                        IF(B3>99,D2,
                        IF(B3>129,D2+0.1,
                        IF(B3>199,D2+0.2,
                        IF(B3>349,D2+0.3,C2-1))))))),D2)


                        Tom

                        Comment


                          #13
                          RE: Formula Puzzle

                          My If statement is a mess! I was just so happy I worked through what all the elements meant that I didn't even attempt to make real code :).

                          I still think there has to a better way than the nested If statements though.

                          BO

                          Comment


                            #14
                            RE: Formula Puzzle

                            Cut and paste, it's a wonderful thing.

                            It really is remarkable how helping your child with grade school math will do to help clear things up.

                            Tom

                            Comment

                            Working...
                            X