Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8474845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:44:02+00:00 2026-06-10T17:44:02+00:00

I am trying to show or hide a button based on the contents of

  • 0

I am trying to show or hide a button based on the contents of a particular database field. I have the field defined as ‘text’, as the field may contain something like 1-1 or 1-20 or 0. If the field (arref1) is not equal to 0 then I want to show my button. Otherwise hide the button. Here is what I have so far but it dosen’t work:

var resultRule = db.execute('SELECT arref1 FROM genrules WHERE title="'+client+'"');
if (resultRule!='0') {

var appliedRule1 = Ti.UI.createButton({
title:' Applied Rule ' + rows.fieldByName('arref1') + '',
bottom:120,
left: 80,
width: 'auto',
height:40,
borderRadius:5,
textAlign: 'center',
color:'#FFFFFF',
backgroundColor:'#7b4336',
backgroundSelectedColor:'#cc9933',
backgroundImage: 'NONE',
font:{fontSize:'20dp'}
});
win.add(appliedRule1);

appliedRule1.addEventListener('click',function(e)
{

    var win = Ti.UI.createWindow({
        url: 'appliedruledetail.js',
        title:' Applied Rule' + rows.fieldByName('arref1') + ''
    });

    var client = '' + rows.fieldByName('genrule') + '' ;
    win.client = client;
    Ti.UI.currentTab.open(win);
}

);
} else{};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:44:04+00:00Added an answer on June 10, 2026 at 5:44 pm

    db.execute returns a Titanium.DB.ResultSet (which is an object) not a string.

    Here is how you use a result set:

    // Get the row with execute, returns a resultSet
    var row = db.execute('SELECT * FROM genrules WHERE title="'+client+'"');
    // Make sure its a valid row
    if (row.isValidRow()){ 
      // Now get the field from the current row
      if(row.fieldByName('arref1') != '0') {
           // Add your button here
      }
    }
    row.close(); // Close the result set since were done with it
    

    I heavily borrowed from this example in the documentation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to show/hide a flash object based on click of button, but
I am currently trying to show/hide a custom ribbon button based on the value
Hi I have been trying to make a show/hide toggle button with jquery but
I'm trying to show/hide some of text in a button. the button is <button
I'm trying to create a Hide/Show button with jQuery. When .cminus is clicked, it
I am trying to hide/show/toggle a div when a button is clicked. I am
Im trying to toggle an animation on height when a button Show Details/Hide Details
I'm working on a small problem where I'm trying to show/hide a panel based
I'm trying to hide or show a div based on the value of some
I'm trying to create a button to show / hide a div below it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.