Best way to construct a URL

I have an external URL that goes to http://somesite.com that I need to construct dynamic URLs to link to using database fields and have them as part of a grid or record detail. What’s the best way to construct such a URL?

I tried using php methods to concatenate for a result (example http://somesite.com/lookup.php?param1=field1&param2=field2) but I’m unsure if that’s the best way since I can’t figure out how to echo the method to a column in the grid.

Any best practices here? Thanks in advance

Hi NoAlias, I think this relates to your other post I just answered. To clarify, if you are linking from your SC generated grid to another SC generated app, like a form or control, then use the Links system. Sc will handle making all the parameter passing, as part of how SC works. You don;t have to manually code that stuff anymore :slight_smile: SC handles the hyperlink and passing your parameters.

  1. In the target app, like a form or control or another grid, create a global variable before doing any linking. Use that global to do something, say in the onScriptInit event. Or anywhere.
    echo "My global is ".[myinfo];
    make sure you set that the global is coming in, under your application - global variables settings. Now when you generate and run the app in the development environment, you will get a prompt to fill that value in for testing. The target app expects that global to come in.

  2. In your grid, use the Links settings on the left hand menu to build a link for your column. See my other reply for how to make the column have a button… When you add the link, you will pick the target app. Since you have a global variable in the target, Sc will prompt you in a wizard to give that a value. That value can come from any field, another global, or even a hard coded value. Pretty cool.

Now when you generate both and run them, the link will work and pass the value(s). Once you get the hang of it, it is a very power way to work - very RAD.
Peace,
Jamie

Thanks again, and yes, this was related to my other post. My problem with these is the onRecord event not working when I reference a field variable. I get php “Undefined Variable” errors at run time. Do I need to dynamically build the link structure in a php method and somehow call it from within onRecord?

OK, I was unaware I needed to use the {table.colum} as the variable