MarkShnier__You
2 years agoQrew Legend
Re: Button that creates a new record based on the selection in the new record
np
URLRoot() & "db/" & [_DBID_SPACES]
& "?a=API_GenAddRecordForm"
& "&_fid_1115=" & URLEncode ([Record ID#])
& "&_fid_12="Renewal"
& "&z=" & Rurl()
Just a note about URLEncode
It never hurts to do URLEncode but when you do it needlessly it just clutters up your formulas and makes them unreadable. In the whole Internet certain characters are not allowed, for example you may have noticed that there are never spaces in a URL. So if for example you wanted to populate "New Lease" into that field, that string has a space in it and would make an illegal URL. So if you were not sure what was going to be put into that field, perhaps it was not a simple hardcoded value but was actually coming from a data field then the syntax would be this
URLRoot() & "db/" & [_DBID_SPACES] & "?a=API_GenAddRecordForm"
& "&_fid_1115=" & URLEncode ([Record ID#])
& "&_fid_12=" & URLEncode("New Lease")
& "&z=" & Rurl()
You will also notice how I broke up your formula into separate lines to keep everything in a consistent pattern. It really pays off to keep your formulas stupid simple to read because a month or a week or a year from now you may be the poor soul who needs to figure out what that formula is doing. Or you may want to be kind to your successor who takes over from you eventually.
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------
URLRoot() & "db/" & [_DBID_SPACES]
& "?a=API_GenAddRecordForm"
& "&_fid_1115=" & URLEncode ([Record ID#])
& "&_fid_12="Renewal"
& "&z=" & Rurl()
Just a note about URLEncode
It never hurts to do URLEncode but when you do it needlessly it just clutters up your formulas and makes them unreadable. In the whole Internet certain characters are not allowed, for example you may have noticed that there are never spaces in a URL. So if for example you wanted to populate "New Lease" into that field, that string has a space in it and would make an illegal URL. So if you were not sure what was going to be put into that field, perhaps it was not a simple hardcoded value but was actually coming from a data field then the syntax would be this
URLRoot() & "db/" & [_DBID_SPACES] & "?a=API_GenAddRecordForm"
& "&_fid_1115=" & URLEncode ([Record ID#])
& "&_fid_12=" & URLEncode("New Lease")
& "&z=" & Rurl()
You will also notice how I broke up your formula into separate lines to keep everything in a consistent pattern. It really pays off to keep your formulas stupid simple to read because a month or a week or a year from now you may be the poor soul who needs to figure out what that formula is doing. Or you may want to be kind to your successor who takes over from you eventually.
------------------------------
Mark Shnier (YQC)
mark.shnier@gmail.com
------------------------------