Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6321 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a table with a large number of records (research participants). Based on their responses to a set of screening questionnaires, they are eligible for 0-5 additional research studies. The research studies are in a related table("studies") containing the name of each study and the eligibility criteria. For each subject in the big table, there are 5 variables, eligible1...eligible5, that are set to either 1 or 0 by a script that evaluates whether the subject has qualified for each one of the 5 studies.

Below is the code that inserts a portal into my php page. As written, it displays all 5 studies. I want it to display only the studies for which the participant is eligible. My idea was to use if statements for each portal row that are based on whether the "eligible" variable corresponding to that row is 1 or 0.

Is there a way to specify a variable name by concatinating a field name and an index variable? In other words, does php allow me to create "if eligible1 = 1" with code like "if eligible{portal_rownum} = 1" where portal_rownum will be substituted out for it's value to create "eligible1" or 2 or 3 etc.

I know nothing about php but have been enabled to a dangerous degree by FMStudio (which rocks!).

TIA

<?php echo array_shift(explode('.',$switchback_row_key)); ?>

<?php

$switchback_studies_portal_rownum = 1;

foreach($switchback_row['studies::study_name'] as $switchback_studies_portal_row=>$switchback_studies_portal){ 

?>

  

    

      �

      hi

    

      

  <?php if($switchback_studies_portal_rownum == 10) break; else $switchback_studies_portal_rownum++;

}//portal_end ?>

Posted

I'm not a PHP expert by any means, but if I understand correctly what you want, maybe this can help:

$portal_rownum = 1;

$eligible = "eligible".$portal_rownum;

$$eligible (note the two dollar signs) will give you a variable named "eligible1" which you can use in your conditional statement.

This topic is 6321 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.