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

If Statement in List Control, List Layout

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

    If Statement in List Control, List Layout

    Hi have a list control that I want to add an if statement to in the list layout section.

    I cannot seem to find the correct format to use to get the layout to display properly.

    Here is my code:

    <div style="display: table; width: 100%;">
    <div style="display: table-cell; vertical-align: middle;">
    </div>{short_name} </div>
    {*if creditcard == 'T'}
    <strong>Starting:</strong> {Session1} <strong>Location: </strong>{location_name}, {location_city} <strong>Balance Due: </strong>{Balance}&nbsp;&nbsp;{PayNow}

    {*elseif creditcard == 'F'}
    <strong>Starting:</strong> {Session1} <strong>Location: </strong>{location_name}, {location_city} <strong>Balance Due: </strong>{Balance}

    {*endif}
    </div>

    </div>​

    There is a field named {creditcard} that is a logical field. In the above code, I am trying to show the {PayNow} button if {creditcard} is true.

    I have tried *if statement with using 'T' or 'true'. Tried with '1' and '0'. I have tried using the {} around the field name, but then nothing appears. I don't know the format to use.

    Can someone help me with that?

    Thanks,

    Mike Reed
    Phoenix, AZ

    #2
    Hi Mike,

    Have you tried using true and false (no quotes) ?
    Gregg
    https://paiza.io is a great site to test and share sql code

    Comment


      #3
      Mike, I think it's .t. or .f.
      It is in Desktop anyway. The dots are important.
      See our Hybrid Option here;
      https://hybridapps.example-software.com/


      Apologies to anyone I haven't managed to upset yet.
      You are held in a queue and I will get to you soon.

      Comment


        #4
        I'm 99% certain the templating uses javascript for the if/then/else commands.
        Gregg
        https://paiza.io is a great site to test and share sql code

        Comment


          #5
          Templating is the same in lists as it is in viewboxes I have a table with a tinyint(1) record called RETURNED in a table and the following code returns a checked checkbox in a row of a list in a viewbox
          Code:
          {*if RETURNED=='T'}
                              <img src="svgIcon=#alpha-icon-checkSquareBorder:icon,24{ fill: #4d73f7; stroke: #f5fa22;}" >    
                          {*endif}​
          ​

          Comment


            #6
            It sounds to me like you need to go to the client-side show/hide, and filter the button there.
            I have attached an image with the syntax used as well.
            Also, you may need to use the Chrome inspector, and see what the actual value is behind the scenes. Sometimes Alpha will change them, or Chrome will...I don't know which or for what situations.

            Comment


              #7
              I have tried using the client show/hide. but that doesn't work. Using the {*if RETURNED statement doesn't work. using the .t. or .f. does work either, no surprise because it wants javascript
              I'm at a loss to figure this out.
              Next step will be to send an email to Selwyn to see what he has to say.

              Thanks for your help.
              Mike

              Mike Reed
              Phoenix, AZ

              Comment


                #8
                What does your logical field actually contain?
                What value are you testing against?
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                Apologies to anyone I haven't managed to upset yet.
                You are held in a queue and I will get to you soon.

                Comment


                  #9
                  Hi Mike,

                  ​​​​​​Let's start at the beginning. Which database are you using?

                  Comment


                    #10
                    Hi Mike,

                    Try this, go to the template tester and enter this into the JSON Data section
                    Code:
                    [{
                        "short_name":"Lance",
                        "creditcard":"T",
                        "Session1":"3/8/2023",
                        "Balance":250,
                        "location_name":"Office",
                        "location_city":"Southampton",
                        "PayNow":"<Button>Pay Now</Button>"
                    },
                    {
                        "short_name":"Mike",
                        "creditcard":"F",
                        "Session1":"1/8/2023",
                        "Balance":1250,
                        "location_name":"Home",
                        "location_city":"Boston",
                        "PayNow":"<Button>Pay Now</Button>"
                    }
                    ]​
                    Then this into the template section
                    HTML Code:
                    <div>{short_name}</div>
                    <div>
                    {*if creditcard=='T'}
                    <strong>Starting:</strong> {Session1} <strong>Location: </strong>{location_name}, {location_city} <strong>Balance Due: </strong>{Balance}&nbsp;&nbsp;{PayNow}
                    {*elseif creditcard=='F'}
                    <strong>Starting:</strong> {Session1} <strong>Location: </strong>{location_name}, {location_city} <strong>Balance Due: </strong>{Balance}
                    
                    {*endif}
                    </div>
                    You should see this in the preview window
                    HTML Code:
                    Lance
                    Starting: 3/8/2023 Location: Office, Southampton Balance Due: 250  Pay Now
                    Mike
                    Starting: 1/8/2023 Location: Home, Boston Balance Due: 1250​

                    Comment


                      #11
                      I have had some trouble with logical fields as well. It seems Alpha treats them "uniquely." Have you tried either, 1. using a tinytext field instead and setting a 1 and 0 in the app instead of true false or 2. creating an SQL if expression that converts the true false to a character field and then doing your show hide with the result of the expression?

                      Comment


                        #12
                        Hi,
                        Lance I tried what you had posted. Thank you for that. Using the template tester everything worked fine. But once posted to the website - no dice. Tried in Safari and Firefox
                        So I tried what Ecalan suggested. I changed my query for the list control to this: SELECT *, CAST(creditcard AS char) as cc FROM unpaidfees WHERE regid = :regid. - Basically I added the cast command
                        Had to uncheck the 'Portable SQL' box in order for the cast command to work.
                        Then I changed the IF statement to {*if cc=='1'}

                        It works!

                        Gentlemen Thank you so much. I have struggled with this for months and now it works.

                        Peace,
                        Mike Reed
                        Phoenix, AZ

                        Comment


                          #13
                          Mike, your solution using CAST to change the field type is probably better than my suggestion of using IF. Less server computation burden I think. I seem to recall that when I first did this, I could not get CAST to work. I know I was unaware of the portable SQL issue. (Thanks for that education). Since then, and until someone explains to me the virtue of using a logical field instead of tinytext for 1s and 0s, I'm sticking with tinytext. (Perhaps the explanation is on its way).

                          Glad you got it working!

                          Comment


                            #14
                            Mike Reed, Can you send an image of your code and where it is? I use if/else statements all the time in lists and could help you. I can also send you a Zoom link if I can't help you over the forum, if you need this expedited.

                            Comment


                              #15
                              Hi Russell,
                              I have an attached the component in a zip file. If you need a sql file to go with it, I'll send that via email since it has some personal info in it.
                              The code is in the 'UnpaidFees' List control, List layout.

                              Thanks for your help.

                              Mike
                              Attached Files
                              Mike Reed
                              Phoenix, AZ

                              Comment

                              Working...
                              X