Forum Discussion
QuickBaseCoachD
8 years agoQrew Captain
I have not done a full test of working code but here is a non javascript approach.
You can do successive URL calls like this, where each of the formula variables is a URL formula, such as API_AddRecord.
Here is an example of a formula I used in an app once.
var text YYOtherMonths = Right(ToText(Year(Today())),2);
var text AddJAN = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "01-01-" & $YYOtherMonths;
var text AddFEB = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "02-01-" & $YYOtherMonths;
var text AddMAR = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "03-01-" & $YYOtherMonths;
var text AddAPR= URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "04-01-" & $YYOtherMonths;
var text AddMAY = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "05-01-" & $YYOtherMonths;
var text AddJUN = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "06-01-" & $YYOtherMonths;
var text AddJUL = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "07-01-" & $YYOtherMonths;
var text AddAUG = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "08-01-" & $YYOtherMonths;
var text AddSEP = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "09-01-" & $YYOtherMonths;
var text AddOCT = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "10-01-" & $YYOtherMonths;
var text AddNOV = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "11-01-" & $YYOtherMonths;
var text AddDEC = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "12-01-" & $YYOtherMonths;
var text DisplayProjectRecordinEditMode = URLRoot() & "db/" & [_dbid_projects] & "?a=er&dfid=19&rid=" & [Project ID#];
$AddJAN
& "&rdr=" & URLEncode($AddFEB)
& URLEncode("&rdr=" & URLEncode($AddMAR))
& URLEncode(URLEncode("&rdr=" & URLEncode($AddAPR)))
& URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddMAY))))
& URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddJUN)))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddJUL))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddAUG)))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddSEP))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddOCT)))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddNOV))))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddDEC)))))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($DisplayProjectRecordinEditMode))))))))))))
So one approach is to just use a version of the the button above to make 11 duplicates, each different by the month. That would work when you have the record made for month 1.
Then you could also make 11 versions of the buttons and use form rules to show / hide the appropriate buttons. For example if the month was "3", then you could show the button which would make months 4,5,6,7,8,9,10 11 and 12.
You can do successive URL calls like this, where each of the formula variables is a URL formula, such as API_AddRecord.
Here is an example of a formula I used in an app once.
var text YYOtherMonths = Right(ToText(Year(Today())),2);
var text AddJAN = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "01-01-" & $YYOtherMonths;
var text AddFEB = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "02-01-" & $YYOtherMonths;
var text AddMAR = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "03-01-" & $YYOtherMonths;
var text AddAPR= URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "04-01-" & $YYOtherMonths;
var text AddMAY = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "05-01-" & $YYOtherMonths;
var text AddJUN = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "06-01-" & $YYOtherMonths;
var text AddJUL = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "07-01-" & $YYOtherMonths;
var text AddAUG = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "08-01-" & $YYOtherMonths;
var text AddSEP = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "09-01-" & $YYOtherMonths;
var text AddOCT = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "10-01-" & $YYOtherMonths;
var text AddNOV = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "11-01-" & $YYOtherMonths;
var text AddDEC = URLRoot() & "db/" & [_DBID_TABLE_1] & "?act=API_AddRecord&_fid_189=" & [Project ID#]& "&_fid_197=" & "12-01-" & $YYOtherMonths;
var text DisplayProjectRecordinEditMode = URLRoot() & "db/" & [_dbid_projects] & "?a=er&dfid=19&rid=" & [Project ID#];
$AddJAN
& "&rdr=" & URLEncode($AddFEB)
& URLEncode("&rdr=" & URLEncode($AddMAR))
& URLEncode(URLEncode("&rdr=" & URLEncode($AddAPR)))
& URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddMAY))))
& URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddJUN)))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddJUL))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddAUG)))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddSEP))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddOCT)))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddNOV))))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($AddDEC)))))))))))
& URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($DisplayProjectRecordinEditMode))))))))))))
So one approach is to just use a version of the the button above to make 11 duplicates, each different by the month. That would work when you have the record made for month 1.
Then you could also make 11 versions of the buttons and use form rules to show / hide the appropriate buttons. For example if the month was "3", then you could show the button which would make months 4,5,6,7,8,9,10 11 and 12.
WilliamEvans1
8 years agoQrew Cadet
All of my users use the latest Chrome so I think i'll be ok with the URL limit....
I am trying to get the code working with just ONE copy + Increment action first (this is my first time coding a url formula, but i'm trying to learn)
So with using the API_AddRecords - to duplicate my record will i need to map each and every source field to the target field - which since i'm creating a duplicate is just each field mapped upon itself? (thus hardcoding it in this formula - bit of a pain if the items table has new fields added at some point?) .... so the url becomes really really long because i have ~60 editable fields to copy thus your concern about the length?
- or should i instead be using "GenCopyRecord" to copy the item, and then just edit the "Month Number" field ? or is it too hard to lock onto the correct field that way?
Am I on the wrong track (i'm still reading about the API/URL formulas)
Thanks!
I am trying to get the code working with just ONE copy + Increment action first (this is my first time coding a url formula, but i'm trying to learn)
So with using the API_AddRecords - to duplicate my record will i need to map each and every source field to the target field - which since i'm creating a duplicate is just each field mapped upon itself? (thus hardcoding it in this formula - bit of a pain if the items table has new fields added at some point?) .... so the url becomes really really long because i have ~60 editable fields to copy thus your concern about the length?
- or should i instead be using "GenCopyRecord" to copy the item, and then just edit the "Month Number" field ? or is it too hard to lock onto the correct field that way?
Am I on the wrong track (i'm still reading about the API/URL formulas)
Thanks!