I have done a bunch of research on this trying to find an answer. I have a value from outside the repeater field that I need to use in the repeater loop. The fields are all from the same page. I want to do something like the following.
$variable = get_field('value');
<?php if( have_rows('repeater') ): ?>
<?php while( have_rows('repeater') ): the_row(); ?>
<?php the_sub_field('some_value'); ?>
<?php echo $variable; ?>
<?php endwhile; ?>
<?php endif; ?>
The code you posted should work if both pieces of code are in the same file (function if applicable)