Conditional button links

Also your code can’t work on the first click, because you assign the link to the button after the click. You need to assign it to the button once you got the value from the dataset (and not on click).