ipp_quickbase_devkit 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +87 -0
- data/README.rdoc +112 -0
- data/doc/QuickBaseClient.rb.htm +1896 -0
- data/doc/ReleaseNotes.txt +43 -0
- data/doc/qbc.makeCSVFile.qbc +4 -0
- data/doc/qbc.makeCSVFile.rb +4 -0
- data/doc/quickbase_adapter.rb.htm +399 -0
- data/examples/cookbookfiles/QuickBaseAPICookbook.html +2590 -0
- data/examples/cookbookfiles/addChangeRemoveUserRole.rb +21 -0
- data/examples/cookbookfiles/addOrEditRecord.rb +10 -0
- data/examples/cookbookfiles/application_object.rb +55 -0
- data/examples/cookbookfiles/applyRubyFormulas.rb +10 -0
- data/examples/cookbookfiles/average.rb +27 -0
- data/examples/cookbookfiles/backupApplication.rb +8 -0
- data/examples/cookbookfiles/cacheSchemas.rb +53 -0
- data/examples/cookbookfiles/calculateRunningTotals.rb +11 -0
- data/examples/cookbookfiles/copyrecords.rb +73 -0
- data/examples/cookbookfiles/count.rb +26 -0
- data/examples/cookbookfiles/createRecordNavigatorHTML.rb +42 -0
- data/examples/cookbookfiles/createReportDashboard.rb +35 -0
- data/examples/cookbookfiles/createTable.rb +12 -0
- data/examples/cookbookfiles/deviation.rb +25 -0
- data/examples/cookbookfiles/downloadCookbook.rb +97 -0
- data/examples/cookbookfiles/downloadFile.rb +10 -0
- data/examples/cookbookfiles/downloadFilesToFolder.rb +81 -0
- data/examples/cookbookfiles/downloadToTextFile.rb +64 -0
- data/examples/cookbookfiles/dumpSchema.rb +11 -0
- data/examples/cookbookfiles/duplicateRecord.rb +8 -0
- data/examples/cookbookfiles/dynamicMethods.rb +33 -0
- data/examples/cookbookfiles/editRecords.rb +15 -0
- data/examples/cookbookfiles/findJohnsLast10Records.rb +17 -0
- data/examples/cookbookfiles/findRubyRecords.rb +17 -0
- data/examples/cookbookfiles/formatCurrency.rb +24 -0
- data/examples/cookbookfiles/formatDate.rb +10 -0
- data/examples/cookbookfiles/formatDuration.rb +27 -0
- data/examples/cookbookfiles/formatPercent.rb +24 -0
- data/examples/cookbookfiles/getAllValuesForFields.rb +18 -0
- data/examples/cookbookfiles/getAppDTMInfo.rb +29 -0
- data/examples/cookbookfiles/getApplicationVariable.rb +5 -0
- data/examples/cookbookfiles/getChildTableDBID.rb +11 -0
- data/examples/cookbookfiles/getColumnListForReport.rb +6 -0
- data/examples/cookbookfiles/getFieldChoices.rb +13 -0
- data/examples/cookbookfiles/getFieldIDs.rb +6 -0
- data/examples/cookbookfiles/getFieldNames.rb +6 -0
- data/examples/cookbookfiles/getLastModTime.rb +8 -0
- data/examples/cookbookfiles/getLastRecModTime.rb +8 -0
- data/examples/cookbookfiles/getNumRecords.rb +8 -0
- data/examples/cookbookfiles/getNumTables.rb +4 -0
- data/examples/cookbookfiles/getRecord.rb +5 -0
- data/examples/cookbookfiles/getRecordDisplayURL.rb +13 -0
- data/examples/cookbookfiles/getRecordsAddedToday.rb +20 -0
- data/examples/cookbookfiles/getRecordsAsJSON.rb +6 -0
- data/examples/cookbookfiles/getReportNames.rb +25 -0
- data/examples/cookbookfiles/getRoleInfo.rb +48 -0
- data/examples/cookbookfiles/getServerStatus.rb +11 -0
- data/examples/cookbookfiles/getSortListForReport.rb +6 -0
- data/examples/cookbookfiles/getTableIDs.rb +6 -0
- data/examples/cookbookfiles/getTableName.rb +8 -0
- data/examples/cookbookfiles/getTableNames.rb +25 -0
- data/examples/cookbookfiles/getTimeCreated.rb +8 -0
- data/examples/cookbookfiles/getTimeInMilliseconds.rb +5 -0
- data/examples/cookbookfiles/getUserInfo.rb +26 -0
- data/examples/cookbookfiles/getUserRole.rb +15 -0
- data/examples/cookbookfiles/intranet.rb +101 -0
- data/examples/cookbookfiles/isAverageField.rb +17 -0
- data/examples/cookbookfiles/isDbidString.rb +8 -0
- data/examples/cookbookfiles/isTotalField.rb +16 -0
- data/examples/cookbookfiles/iterateDBPages.rb +8 -0
- data/examples/cookbookfiles/iterateFilteredRecords.rb +12 -0
- data/examples/cookbookfiles/iterateJoinRecords.rb +68 -0
- data/examples/cookbookfiles/iterateRecordInfos.rb +8 -0
- data/examples/cookbookfiles/iterateRecords.rb +23 -0
- data/examples/cookbookfiles/iterateSummaryRecords.rb +13 -0
- data/examples/cookbookfiles/iterateUnionRecords.rb +38 -0
- data/examples/cookbookfiles/listAccessibleApplications.rb +6 -0
- data/examples/cookbookfiles/logRequestAndResponseXML.rb +8 -0
- data/examples/cookbookfiles/lookupFieldPropertyByName.rb +62 -0
- data/examples/cookbookfiles/lookupFieldTypeByName.rb +10 -0
- data/examples/cookbookfiles/makeCSVFile.rb +4 -0
- data/examples/cookbookfiles/makeSlideShow.rb +42 -0
- data/examples/cookbookfiles/makerecs.rb +64 -0
- data/examples/cookbookfiles/max.rb +26 -0
- data/examples/cookbookfiles/min.rb +26 -0
- data/examples/cookbookfiles/percent.rb +29 -0
- data/examples/cookbookfiles/printChildElements.rb +54 -0
- data/examples/cookbookfiles/printNewRecords.rb +12 -0
- data/examples/cookbookfiles/processRESTRequest.rb +21 -0
- data/examples/cookbookfiles/provisionAndInviteNewUser.rb +13 -0
- data/examples/cookbookfiles/purgeRecords.rb +15 -0
- data/examples/cookbookfiles/quickbase_adapter.rb.htm +397 -0
- data/examples/cookbookfiles/quickbase_record_finder.zip +0 -0
- data/examples/cookbookfiles/recordAndFieldIterator.rb +24 -0
- data/examples/cookbookfiles/runImport.rb +9 -0
- data/examples/cookbookfiles/runQuickBaseTwitterConnector.rb +41 -0
- data/examples/cookbookfiles/sendToQuickBase.rb +33 -0
- data/examples/cookbookfiles/setDBvar.rb +6 -0
- data/examples/cookbookfiles/showRequestAndResponseXML.rb +8 -0
- data/examples/cookbookfiles/sqlQuery.rb +11 -0
- data/examples/cookbookfiles/stopOnError.rb +10 -0
- data/examples/cookbookfiles/sum.rb +26 -0
- data/examples/cookbookfiles/twitterFromQuickBase.rb +42 -0
- data/examples/cookbookfiles/twitterWithQuickBase.rb +36 -0
- data/examples/cookbookfiles/uploadCSVData.rb +20 -0
- data/examples/cookbookfiles/uploadExcelData.rb +22 -0
- data/examples/cookbookfiles/uploadFileEveryHour.rb +18 -0
- data/examples/cookbookfiles/uploadFileIntoNewRecord.rb +8 -0
- data/examples/cookbookfiles/uploadFilesFromFolder.exe +0 -0
- data/examples/cookbookfiles/uploadFilesFromFolder.rb +69 -0
- data/examples/cookbookfiles/useCompanyURL.rb +12 -0
- data/examples/cookbookfiles/userRoles.rb +49 -0
- data/examples/cookbookfiles/watchCommunityForum.rb +5 -0
- data/examples/cookbookfiles/wikifyTable.rb +29 -0
- data/examples/cookbookfiles/xmlShortcuts.rb +33 -0
- data/examples/pmp/app/controllers/application.rb +7 -0
- data/examples/pmp/app/controllers/contacts_controller.rb +8 -0
- data/examples/pmp/app/controllers/document_library_controller.rb +2 -0
- data/examples/pmp/app/controllers/issues_controller.rb +5 -0
- data/examples/pmp/app/controllers/projects_controller.rb +22 -0
- data/examples/pmp/app/controllers/resources_controller.rb +2 -0
- data/examples/pmp/app/controllers/tasks_controller.rb +13 -0
- data/examples/pmp/app/controllers/time_cards_controller.rb +5 -0
- data/examples/pmp/app/helpers/application_helper.rb +3 -0
- data/examples/pmp/app/helpers/contacts_helper.rb +2 -0
- data/examples/pmp/app/helpers/document_library_helper.rb +2 -0
- data/examples/pmp/app/helpers/issues_helper.rb +2 -0
- data/examples/pmp/app/helpers/projects_helper.rb +2 -0
- data/examples/pmp/app/helpers/resources_helper.rb +2 -0
- data/examples/pmp/app/helpers/tasks_helper.rb +2 -0
- data/examples/pmp/app/helpers/time_cards_helper.rb +2 -0
- data/examples/pmp/app/models/contacts.rb +26 -0
- data/examples/pmp/app/models/document_library.rb +2 -0
- data/examples/pmp/app/models/issues.rb +6 -0
- data/examples/pmp/app/models/projects.rb +26 -0
- data/examples/pmp/app/models/resources.rb +2 -0
- data/examples/pmp/app/models/tasks.rb +12 -0
- data/examples/pmp/app/models/time_cards.rb +7 -0
- data/examples/pmp/app/schemas/contacts.xml +1 -0
- data/examples/pmp/app/schemas/document_library.xml +1 -0
- data/examples/pmp/app/schemas/issues.xml +1 -0
- data/examples/pmp/app/schemas/pmp.xml +1 -0
- data/examples/pmp/app/schemas/projects.xml +1 -0
- data/examples/pmp/app/schemas/readme.txt +8 -0
- data/examples/pmp/app/schemas/resources.xml +1 -0
- data/examples/pmp/app/schemas/tasks.xml +1 -0
- data/examples/pmp/app/schemas/time_cards.xml +1 -0
- data/examples/pmp/app/views/contacts/companies.rhtml +31 -0
- data/examples/pmp/app/views/contacts/project_contacts.rhtml +31 -0
- data/examples/pmp/app/views/issues/filter_issues.rhtml +26 -0
- data/examples/pmp/app/views/layouts/application.rhtml +56 -0
- data/examples/pmp/app/views/projects/all_projects.rhtml +33 -0
- data/examples/pmp/app/views/projects/home.rhtml +11 -0
- data/examples/pmp/app/views/projects/my_open_projects.rhtml +27 -0
- data/examples/pmp/app/views/projects/open_projects.rhtml +44 -0
- data/examples/pmp/app/views/projects/project_sorted_by_company.rhtml +40 -0
- data/examples/pmp/app/views/projects/projects_sorted_by_priority.rhtml +30 -0
- data/examples/pmp/app/views/projects/updated_projects.rhtml +0 -0
- data/examples/pmp/app/views/tasks/all_tasks.rhtml +27 -0
- data/examples/pmp/app/views/tasks/search.rhtml +23 -0
- data/examples/pmp/app/views/tasks/search2.rhtml +23 -0
- data/examples/pmp/app/views/tasks/search3.rhtml +23 -0
- data/examples/pmp/app/views/time_cards/summary.rhtml +38 -0
- data/examples/pmp/config/boot.rb +45 -0
- data/examples/pmp/config/database.yml +30 -0
- data/examples/pmp/config/environment.rb +60 -0
- data/examples/pmp/config/environments/development.rb +21 -0
- data/examples/pmp/config/environments/production.rb +18 -0
- data/examples/pmp/config/environments/test.rb +19 -0
- data/examples/pmp/config/routes.rb +23 -0
- data/examples/pmp/db/migrate/001_create_projects.rb +10 -0
- data/examples/pmp/db/migrate/002_create_tasks.rb +10 -0
- data/examples/pmp/db/migrate/003_create_issues.rb +10 -0
- data/examples/pmp/db/migrate/004_create_document_libraries.rb +10 -0
- data/examples/pmp/db/migrate/005_create_resources.rb +10 -0
- data/examples/pmp/db/migrate/006_create_time_cards.rb +10 -0
- data/examples/pmp/db/migrate/007_create_contacts.rb +10 -0
- data/examples/pmp/public/404.html +30 -0
- data/examples/pmp/public/500.html +30 -0
- data/examples/pmp/public/app.index.html +277 -0
- data/examples/pmp/public/dispatch.cgi +10 -0
- data/examples/pmp/public/dispatch.fcgi +24 -0
- data/examples/pmp/public/dispatch.rb +10 -0
- data/examples/pmp/public/favicon.ico +0 -0
- data/examples/pmp/public/images/rails.png +0 -0
- data/examples/pmp/public/javascripts/application.js +2 -0
- data/examples/pmp/public/javascripts/controls.js +833 -0
- data/examples/pmp/public/javascripts/dragdrop.js +942 -0
- data/examples/pmp/public/javascripts/effects.js +1088 -0
- data/examples/pmp/public/javascripts/prototype.js +2515 -0
- data/examples/pmp/public/robots.txt +1 -0
- data/examples/pmp/test/fixtures/contacts.yml +5 -0
- data/examples/pmp/test/fixtures/document_libraries.yml +5 -0
- data/examples/pmp/test/fixtures/issues.yml +5 -0
- data/examples/pmp/test/fixtures/projects.yml +5 -0
- data/examples/pmp/test/fixtures/resources.yml +5 -0
- data/examples/pmp/test/fixtures/tasks.yml +5 -0
- data/examples/pmp/test/fixtures/time_cards.yml +5 -0
- data/examples/pmp/test/functional/contacts_controller_test.rb +18 -0
- data/examples/pmp/test/functional/document_library_controller_test.rb +18 -0
- data/examples/pmp/test/functional/issues_controller_test.rb +18 -0
- data/examples/pmp/test/functional/projects_controller_test.rb +18 -0
- data/examples/pmp/test/functional/resources_controller_test.rb +18 -0
- data/examples/pmp/test/functional/tasks_controller_test.rb +18 -0
- data/examples/pmp/test/functional/time_cards_controller_test.rb +18 -0
- data/examples/pmp/test/test_helper.rb +28 -0
- data/examples/pmp/test/unit/contacts_test.rb +10 -0
- data/examples/pmp/test/unit/document_library_test.rb +10 -0
- data/examples/pmp/test/unit/issues_test.rb +10 -0
- data/examples/pmp/test/unit/projects_test.rb +10 -0
- data/examples/pmp/test/unit/resources_test.rb +10 -0
- data/examples/pmp/test/unit/tasks_test.rb +10 -0
- data/examples/pmp/test/unit/time_cards_test.rb +10 -0
- data/lib/QuickBaseClient.rb +5054 -0
- data/lib/QuickBaseCommandLineClient.rb +401 -0
- data/lib/QuickBaseContactsAppBuilder.rb +419 -0
- data/lib/QuickBaseEmailer.rb +334 -0
- data/lib/QuickBaseEventNotifier.rb +592 -0
- data/lib/QuickBaseMisc.rb +96 -0
- data/lib/QuickBaseObjects.rb +566 -0
- data/lib/QuickBaseRSSGenerator.rb +286 -0
- data/lib/QuickBaseTextData.rb +545 -0
- data/lib/QuickBaseTwitterConnector.rb +300 -0
- data/lib/QuickBaseWebClient.rb +126 -0
- data/lib/WorkPlaceClient.rb +45 -0
- data/lib/qbc.makeCSVFile.qbc +4 -0
- data/lib/qbc.makeCSVFile.rb +17 -0
- data/lib/quickbase_adapter.rb +320 -0
- data/lib/runFieldEntryDialog.rb +151 -0
- data/lib/runOfflineFieldEntryDialog.rb +203 -0
- data/rakefile +100 -0
- data/test/run_tests.bat +7 -0
- data/test/spec_all_tests.rb +13 -0
- data/test/spec_smoke_tests.rb +58 -0
- data/test/spec_workplace_addrecord_test.rb +46 -0
- data/test/spec_workplace_base_test.rb +57 -0
- data/test/spec_workplace_editrecord_test.rb +38 -0
- data/test/spec_workplace_json_test.rb +38 -0
- data/test/spec_workplace_objects_test.rb +39 -0
- data/test/spec_workplace_smoke_tests.rb +45 -0
- metadata +353 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new("username","password")
|
5
|
+
|
6
|
+
# get Fred's QuickBase user info
|
7
|
+
qbc.getUserInfo("fred_flintstone@internet.com")
|
8
|
+
|
9
|
+
fredsUserID = qbc.userid.dup
|
10
|
+
|
11
|
+
# Assume "10" is the id of the Viewer role in the application with the "bbqm84dzy" id
|
12
|
+
qbc.addUserToRole( "bbqm84dzy", fredsUserID, "10" )
|
13
|
+
|
14
|
+
# Assume "11" is the id of the Participant role in the application with the "bbqm84dzy" id
|
15
|
+
qbc.changeUserRole( "bbqm84dzy", fredsUserID, "10", "11" )
|
16
|
+
|
17
|
+
# Remove Fred from the Participant Role
|
18
|
+
qbc.removeUserFromRole( "bbqm84dzy", fredsUserID, "11" )
|
19
|
+
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new("username","password")
|
5
|
+
|
6
|
+
# Attempt to change Name to Fred in record 7
|
7
|
+
# If there is no record 7, add a new record and set the Name to Fred.
|
8
|
+
qbc.addFieldValuePair("Name",nil,nil,"Fred")
|
9
|
+
qbc.addOrEditRecord("dbiddbid",qbc.fvlist,"7")
|
10
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'QuickBaseObjects'
|
2
|
+
|
3
|
+
qbob = QuickBase::Objects::Builder.new("username","password")
|
4
|
+
|
5
|
+
myApplication = qbob.application("My Application")
|
6
|
+
|
7
|
+
puts "\n\nApplication name:\n"
|
8
|
+
puts myApplication.name
|
9
|
+
|
10
|
+
puts "\n\nApplication roles:\n"
|
11
|
+
myApplication.roles.each_value{|role|puts "name: #{role.name}, id: #{role.id}, access: #{role.access}"}
|
12
|
+
|
13
|
+
puts "\n\nApplication users:\n"
|
14
|
+
myApplication.users.each_value{|user|puts "id: #{user.id}"}
|
15
|
+
|
16
|
+
puts "\n\nApplication variables:\n"
|
17
|
+
myApplication.variables.each_value{|variable|puts "#{variable.name}: #{variable.value}"}
|
18
|
+
|
19
|
+
puts "\n\nValue of application variable 'TestVariable':\n"
|
20
|
+
puts myApplication.vTestVariable
|
21
|
+
|
22
|
+
puts "\n\nSet the value of application variable 'TestVariable':\n"
|
23
|
+
myApplication.vTestVariable="New value for test variable"
|
24
|
+
|
25
|
+
puts "\n\nApplication pages:\n"
|
26
|
+
myApplication.pages.each_value{|page|puts page.name}
|
27
|
+
|
28
|
+
puts "\n\nDefault application page:\n"
|
29
|
+
puts myApplication.pDefault_Dashboard.name
|
30
|
+
|
31
|
+
puts "\n\nTables from My Application:\n"
|
32
|
+
myApplication.tables.each_value{|table|puts table.name}
|
33
|
+
|
34
|
+
puts "\n\nQueries from the Contacts table:\n"
|
35
|
+
myApplication.tContacts.queries.each_value{|query|puts query.name}
|
36
|
+
|
37
|
+
puts "\n\nProperties of the List All query from the Contacts table:\n"
|
38
|
+
myApplication.tContacts.qList_All.properties.each_pair{|key,value|puts "#{key}: #{value}" }
|
39
|
+
|
40
|
+
puts "\n\nNames from the List All query from the Contacts table:\n"
|
41
|
+
records = myApplication.tContacts.qList_All.run
|
42
|
+
records.each{|record| puts record.fName}
|
43
|
+
|
44
|
+
puts "\n\nColumns of the List All query from the Contacts table:\n"
|
45
|
+
puts myApplication.tContacts.qList_All.qyclst
|
46
|
+
|
47
|
+
puts "\n\nFields from the Contacts table:\n"
|
48
|
+
myApplication.tContacts.fields.each_value{|field|puts field.name}
|
49
|
+
|
50
|
+
puts "\n\nField ID of the Phone field in the Contacts table:\n"
|
51
|
+
puts myApplication.tContacts.fPhone.id
|
52
|
+
|
53
|
+
puts "\n\nName of field 7 from the Contacts table:\n"
|
54
|
+
puts myApplication.tContacts.fields["7"].name
|
55
|
+
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
|
3
|
+
qbc = QuickBase::Client.new(ENV["quickbase_username"],ENV["quickbase_password"])
|
4
|
+
qbc.iterateRecords("bdcvpsxpy",qbc.getFieldNames("bdcvpsxpy")){|record|
|
5
|
+
nameAndNumber = eval(record['ruby formula 1']) || "<name and number>"
|
6
|
+
qbc.clearFieldValuePairList
|
7
|
+
qbc.addFieldValuePair("name+number",nil,nil,nameAndNumber)
|
8
|
+
qbc.editRecord("bdcvpsxpy", record['Record ID#'],qbc.fvlist)
|
9
|
+
}
|
10
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new("username","password")
|
5
|
+
|
6
|
+
qbc.iterateRecords("bcct3jb3b",["number"]){|record|
|
7
|
+
puts "number: #{record['number']}"
|
8
|
+
}
|
9
|
+
|
10
|
+
average = qbc.average("bcct3jb3b",["number"])
|
11
|
+
puts "average: #{average['number']}"
|
12
|
+
|
13
|
+
=begin
|
14
|
+
|
15
|
+
number: 62
|
16
|
+
number: 21
|
17
|
+
number: 76
|
18
|
+
number: 13
|
19
|
+
number: 34
|
20
|
+
number: 2
|
21
|
+
number: 66
|
22
|
+
number: 2
|
23
|
+
number: 3
|
24
|
+
average: 31.0
|
25
|
+
|
26
|
+
|
27
|
+
=end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
|
3
|
+
qbc = QuickBase::Client.new( "my_username", "my_password", "my_application" )
|
4
|
+
|
5
|
+
# "true" at the end means copy all the data, not just the structure of the database
|
6
|
+
qbc.cloneDatabase( qbc.dbid, "my_application_backup", "backup of my_application", true )
|
7
|
+
|
8
|
+
qbc.signOut
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
|
3
|
+
qbc = QuickBase::Client.new
|
4
|
+
|
5
|
+
# get the schema for the QuickBase Community Forum
|
6
|
+
firstTime=true
|
7
|
+
2.times {
|
8
|
+
|
9
|
+
totalTime = Time.now
|
10
|
+
|
11
|
+
8.times {
|
12
|
+
getSchemaTime = Time.now
|
13
|
+
qbc.getSchema("bbqm84dzy")
|
14
|
+
puts "getSchema took #{Time.now-getSchemaTime} seconds"
|
15
|
+
}
|
16
|
+
|
17
|
+
puts "\nTotal time: #{Time.now-totalTime} seconds"
|
18
|
+
|
19
|
+
qbc.signOut
|
20
|
+
qbc = QuickBase::Client.new
|
21
|
+
qbc.cacheSchemas = true
|
22
|
+
puts "Caching schema..." if firstTime
|
23
|
+
firstTime = false
|
24
|
+
}
|
25
|
+
|
26
|
+
=begin
|
27
|
+
|
28
|
+
Sample output of the above script:-
|
29
|
+
|
30
|
+
getSchema took 1.438 seconds
|
31
|
+
getSchema took 0.515 seconds
|
32
|
+
getSchema took 0.5 seconds
|
33
|
+
getSchema took 0.485 seconds
|
34
|
+
getSchema took 0.515 seconds
|
35
|
+
getSchema took 0.532 seconds
|
36
|
+
getSchema took 0.484 seconds
|
37
|
+
getSchema took 0.5 seconds
|
38
|
+
|
39
|
+
Total time: 4.969 seconds
|
40
|
+
Caching schema...
|
41
|
+
getSchema took 0.515 seconds
|
42
|
+
getSchema took 0.016 seconds
|
43
|
+
getSchema took 0.015 seconds
|
44
|
+
getSchema took 0.0 seconds
|
45
|
+
getSchema took 0.016 seconds
|
46
|
+
getSchema took 0.0 seconds
|
47
|
+
getSchema took 0.016 seconds
|
48
|
+
getSchema took 0.031 seconds
|
49
|
+
|
50
|
+
Total time: 0.609 seconds
|
51
|
+
|
52
|
+
=end
|
53
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
|
3
|
+
qbc = QuickBase::Client.new(ENV["quickbase_username"],ENV["quickbase_password"])
|
4
|
+
|
5
|
+
runningTotal = 0
|
6
|
+
qbc.iterateRecords("bdcvpsxpy",qbc.getFieldNames("bdcvpsxpy"),nil,nil,"List All by Date Created"){|record|
|
7
|
+
runningTotal += record['number'].to_i
|
8
|
+
qbc.clearFieldValuePairList
|
9
|
+
qbc.addFieldValuePair("running total",nil,nil,runningTotal.to_s)
|
10
|
+
qbc.editRecord("bdcvpsxpy",record['Record ID#'],qbc.fvlist)
|
11
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
require 'Date'
|
3
|
+
|
4
|
+
if ARGV.length < 4
|
5
|
+
puts "\n Usage: ruby copyrecords.rb <username> <password> <sourceTableDBID> <targetTableDBID>\n"
|
6
|
+
puts "\n e.g. ruby copyrecords.rb myusername mypassword xxxxxxxxx yyyyyyyyy\n."
|
7
|
+
puts "\n Adds copies of records from a main table to a history table."
|
8
|
+
puts "\n This script assumes the field names match between the two tables.\n"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
qbc = QuickBase::Client.new( ARGV[0], ARGV[1] )
|
13
|
+
|
14
|
+
#Uncomment the following line to see the data being sent to QuickBase and returned from QuickBase
|
15
|
+
#qbc.printRequestsAndResponses = true
|
16
|
+
|
17
|
+
#fieldNames is the list of fields values you want to copy
|
18
|
+
#Change the list to match your real field names.
|
19
|
+
|
20
|
+
fieldNames = Array.new
|
21
|
+
fieldNames = [ "Record ID#", "Date Updated", "Title", "Description", "MutipleChoiceField" ]
|
22
|
+
|
23
|
+
puts "Adding copies of all source table records to target table"
|
24
|
+
|
25
|
+
#fieldValues is a hash of arrays of field values from all records in the source table
|
26
|
+
qbc.getSchema( ARGV[2] )
|
27
|
+
fieldValues = qbc.getAllValuesForFields( ARGV[2], fieldNames )
|
28
|
+
numRecs = fieldValues[ "Record ID#" ].length
|
29
|
+
|
30
|
+
#for each record (i) retrieved from the source table...
|
31
|
+
(0..numRecs.to_i-1).each{ |i|
|
32
|
+
|
33
|
+
#clear previously uploaded field values
|
34
|
+
qbc.clearFieldValuePairList
|
35
|
+
|
36
|
+
#loop through the list of field values for record i
|
37
|
+
fieldValues.each { |fieldName,valueArray|
|
38
|
+
|
39
|
+
# get the value of fieldName in record i
|
40
|
+
value = valueArray[i]
|
41
|
+
|
42
|
+
# copy the field name - it will need to be changed for some fields
|
43
|
+
targetFieldName = fieldName.dup
|
44
|
+
|
45
|
+
# date fields must be converted from the numeric version to a format that can be sent back to QuickBase
|
46
|
+
value = qbc.formatDate( value, nil, true ) if targetFieldName == "Date Updated"
|
47
|
+
|
48
|
+
# put the source table's Record ID# in a different field in the target table
|
49
|
+
# (you could do this for any field that has a different name in the target table)
|
50
|
+
targetFieldName = "Source Record ID #" if targetFieldName == "Record ID#"
|
51
|
+
|
52
|
+
# the values of multiple choice fields must be in the list of available choices
|
53
|
+
if targetFieldName == "MutipleChoiceField"
|
54
|
+
qbc._fieldNameAddChoices( targetFieldName, value )
|
55
|
+
end
|
56
|
+
|
57
|
+
# add the field value to the list of fields to be uploaded to the target table
|
58
|
+
qbc.addFieldValuePair( targetFieldName, nil, nil, value )
|
59
|
+
}
|
60
|
+
|
61
|
+
puts "Adding record #{i} of #{numRecs.to_i-1}"
|
62
|
+
qbc.addRecord( ARGV[3], qbc.fvlist )
|
63
|
+
|
64
|
+
# print any error message from QuickBase, if there was one
|
65
|
+
if !qbc.requestSucceeded
|
66
|
+
qbc.printLastError
|
67
|
+
end
|
68
|
+
|
69
|
+
}
|
70
|
+
|
71
|
+
# signout of QuickBase
|
72
|
+
qbc.signOut
|
73
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new("username","password")
|
5
|
+
|
6
|
+
qbc.iterateRecords("bcct3jb3b",["number"]){|record|
|
7
|
+
puts "number: #{record['number']}"
|
8
|
+
}
|
9
|
+
|
10
|
+
count = qbc.count("bcct3jb3b",["number"])
|
11
|
+
puts "count: #{count['number']}"
|
12
|
+
|
13
|
+
=begin
|
14
|
+
|
15
|
+
number: 62
|
16
|
+
number: 21
|
17
|
+
number: 76
|
18
|
+
number: 13
|
19
|
+
number: 34
|
20
|
+
number: 2
|
21
|
+
number: 66
|
22
|
+
number: 2
|
23
|
+
number: 3
|
24
|
+
count: 9
|
25
|
+
|
26
|
+
=end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
require 'QuickBaseMisc'
|
4
|
+
|
5
|
+
qbc = QuickBase::Client.new
|
6
|
+
|
7
|
+
i = 0
|
8
|
+
recordViewLinks = ""
|
9
|
+
qbc.iterateRecords("8emtadvk",["Message ID#","Subject"]){|msg|
|
10
|
+
if i < 15
|
11
|
+
r = QuickBase::Misc.decimalToBase32(msg['Message ID#'])
|
12
|
+
recordViewLinks << "<a href=\"https://www.quickbase.com/db/8emtadvk?a=dr&r=#{r}\" target=\"RecordContainer\">#{msg['Subject']}</a><br>"
|
13
|
+
end
|
14
|
+
i += 1
|
15
|
+
}
|
16
|
+
|
17
|
+
html = <<EndHTML
|
18
|
+
|
19
|
+
<html>
|
20
|
+
<head>
|
21
|
+
<style type="text/css">
|
22
|
+
td { white-space: nowrap; vertical-align: top }
|
23
|
+
</style>
|
24
|
+
</head>
|
25
|
+
<body>
|
26
|
+
<table border="1" >
|
27
|
+
<tr><td><b>Community Forum Records</b><td><td></tr>
|
28
|
+
<tr>
|
29
|
+
<td>
|
30
|
+
#{recordViewLinks}
|
31
|
+
</td>
|
32
|
+
<td>
|
33
|
+
<iframe name="RecordContainer" Width="800" Height="650" />
|
34
|
+
</td>
|
35
|
+
</tr>
|
36
|
+
</table>
|
37
|
+
</body>
|
38
|
+
</html>
|
39
|
+
|
40
|
+
EndHTML
|
41
|
+
|
42
|
+
File.open("QuickBaseCommunityForumRecordViewer.html","w"){|f|f.write(html)}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new
|
5
|
+
|
6
|
+
reportsHTML = ""
|
7
|
+
reportNames = qbc.getReportNames("8emtadvk")
|
8
|
+
reportNames.each{|reportName|
|
9
|
+
report = qbc.lookupQueryByName(reportName)
|
10
|
+
reportID = report.attributes["id"]
|
11
|
+
reportsHTML << "<a href=\"https://www.quickbase.com/db/8emtadvk?a=q&qid=#{reportID}\" target=\"ReportContainer\" >#{reportName}</a><BR>"
|
12
|
+
}
|
13
|
+
|
14
|
+
html = "<html>"
|
15
|
+
html << "<head>"
|
16
|
+
html << "<style type=\"text/css\">"
|
17
|
+
html << "td { white-space: nowrap; vertical-align: top }"
|
18
|
+
html << "</style>"
|
19
|
+
html << "</head>"
|
20
|
+
html << "<body>"
|
21
|
+
html << "<table border=\"1\" >"
|
22
|
+
html << "<tr><td><b>Community Forum Reports</b><td><td></tr>"
|
23
|
+
html << "<tr>"
|
24
|
+
html << "<td><b>"
|
25
|
+
html << reportsHTML
|
26
|
+
html << "</b></td>"
|
27
|
+
html << "<td>"
|
28
|
+
html << "<iframe name=\"ReportContainer\" Width=\"700\" Height=\"800\" />"
|
29
|
+
html << "</td>"
|
30
|
+
html << "</tr>"
|
31
|
+
html << "</table>"
|
32
|
+
html << "</body>"
|
33
|
+
html << "</html>"
|
34
|
+
|
35
|
+
File.open("QuickBaseCommunityForumReports.html","w"){|f|f.write(html)}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'QuickBaseClient'
|
3
|
+
|
4
|
+
qbc = QuickBase::Client.new("username","password")
|
5
|
+
|
6
|
+
qbc.applyDeviationToRecords("bcc9qcnxw","number","deviation")
|
7
|
+
|
8
|
+
numberAverage = qbc.average("bcc9qcnxw",["number"])
|
9
|
+
puts "number average: #{numberAverage['number']}"
|
10
|
+
|
11
|
+
qbc.iterateRecords("bcc9qcnxw",["number","deviation"]){|record|
|
12
|
+
puts "number: #{record['number']}, deviation: #{record['deviation']}"
|
13
|
+
}
|
14
|
+
|
15
|
+
=begin
|
16
|
+
|
17
|
+
Sample output of above script:-
|
18
|
+
|
19
|
+
number average: 31.0
|
20
|
+
number: 20, deviation: 11
|
21
|
+
number: 36, deviation: 5
|
22
|
+
number: 56, deviation: 25
|
23
|
+
number: 12, deviation: 19
|
24
|
+
|
25
|
+
=end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'QuickBaseClient'
|
2
|
+
require 'cgi'
|
3
|
+
|
4
|
+
if ARGV.length < 2
|
5
|
+
puts "\n Usage: ruby downloadCookbook.rb <username> <password>\n"
|
6
|
+
puts "\n This script copies the recipes from the QuickBase API Cookbook to your local drive.\n"
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
|
10
|
+
qbc = QuickBase::Client.new( ARGV[0], ARGV[1] )
|
11
|
+
|
12
|
+
fieldsToDownload = [ "Record ID#", "Title", "Keywords", "Problem", "Solution", "Discussion", "See Also", "File Attachment", "Ingredient 1", "Ingredient 2", "Ingredient 3", "Chef" ]
|
13
|
+
|
14
|
+
# this is the original QuickBase API Cookbook v3 recipes table
|
15
|
+
fieldValues = qbc.getAllValuesForFields( "bcdcajmrg", fieldsToDownload, nil, nil, "List All" )
|
16
|
+
|
17
|
+
numRecs = fieldValues[ "Record ID#" ].length
|
18
|
+
|
19
|
+
cwd=Dir.getwd
|
20
|
+
fileprefix = "#{cwd}/cookbookfiles/"
|
21
|
+
Dir.mkdir( fileprefix ) if !File.exists?( fileprefix )
|
22
|
+
Dir.chdir( fileprefix )
|
23
|
+
|
24
|
+
File.open( "QuickBaseAPICookbook.html", "w" ) { |outputFile |
|
25
|
+
|
26
|
+
outputFile.write( "<HTML><HEAD><TITLE>QuickBase API Cookbook v3</TITLE></HEAD><BODY><H1><a href=\"https://www.quickbase.com/db/bcdcajmrg\">QuickBase API Cookbook v3</a></H1>" )
|
27
|
+
|
28
|
+
(0..numRecs.to_i-1).each{ |i|
|
29
|
+
|
30
|
+
link = ""
|
31
|
+
title = ""
|
32
|
+
keywords = ""
|
33
|
+
problem = ""
|
34
|
+
solution = ""
|
35
|
+
discussion =""
|
36
|
+
seeAlso = ""
|
37
|
+
file = ""
|
38
|
+
ingredient1 = ""
|
39
|
+
ingredient2 = ""
|
40
|
+
ingredient3 = ""
|
41
|
+
chef = ""
|
42
|
+
recordID = ""
|
43
|
+
|
44
|
+
fieldValues.each { |fieldName,valueArray|
|
45
|
+
|
46
|
+
# get the value of fieldName in record i
|
47
|
+
value = valueArray[i]
|
48
|
+
|
49
|
+
value.gsub!("<BR/>","\n")
|
50
|
+
|
51
|
+
case fieldName
|
52
|
+
when "Record ID#"
|
53
|
+
link = "https://www.quickbase.com/db/bcdcajmrg?a=dr&rid=#{value}"
|
54
|
+
recordID = value.dup
|
55
|
+
when "Title" then title = "#{CGI.escapeHTML(value)}"
|
56
|
+
when "Keywords" then keywords = "<h3>Keywords</h3>#{CGI.escapeHTML(value)}<br>"
|
57
|
+
when "Problem" then problem = "<h3>Problem:</h3>#{CGI.escapeHTML(value)}<br>"
|
58
|
+
when "Solution" then solution = "<h3>Solution:</h3><pre>#{CGI.escapeHTML(value)}</pre><br>"
|
59
|
+
when "Discussion" then discussion = "<h3>Discussion:</h3>#{CGI.escapeHTML(value)}<br>"
|
60
|
+
when "See Also" then seeAlso = "<h3>See Also:</h3>#{CGI.escapeHTML(value)}<br>"
|
61
|
+
when "File Attachment"
|
62
|
+
if value.length > 0
|
63
|
+
fileToWrite = "#{fileprefix}#{value}"
|
64
|
+
#file = "<h3>File Attachment:</h3><a href=\"file:///#{fileprefix}#{value}\">#{fileprefix}#{value}</a><br>"
|
65
|
+
file = "<h3>File Attachment:</h3><a href=\"#{value}\">#{value}</a><br>"
|
66
|
+
qbc.downLoadFile(qbc.dbid, recordID, "12" )
|
67
|
+
fileContents = qbc.fileContents.dup
|
68
|
+
if fileContents.length > 0
|
69
|
+
fileContents.gsub!( "\r\n", "\n" )
|
70
|
+
File.open( fileToWrite, "w" ){|f|f.write(fileContents) }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
when "Ingredient 1" then ingredient1 = "<h3>Ingredients:</h3>#{CGI.escapeHTML(value)}, "
|
74
|
+
when "Ingredient 2" then ingredient2 = "#{CGI.escapeHTML(value)}, "
|
75
|
+
when "Ingredient 3" then ingredient3 = "#{CGI.escapeHTML(value)}<br>"
|
76
|
+
when "Chef" then chef = "<h3>Chef:</h3>#{CGI.escapeHTML(value)}<br>"
|
77
|
+
end
|
78
|
+
}
|
79
|
+
|
80
|
+
title = "<h2><a href=\"#{link}\">#{title}</a>"
|
81
|
+
|
82
|
+
outputFile.write( title )
|
83
|
+
outputFile.write( keywords )
|
84
|
+
outputFile.write( problem )
|
85
|
+
outputFile.write( solution )
|
86
|
+
outputFile.write( discussion )
|
87
|
+
outputFile.write( seeAlso )
|
88
|
+
outputFile.write( file )
|
89
|
+
outputFile.write( ingredient1)
|
90
|
+
outputFile.write( ingredient2 )
|
91
|
+
outputFile.write( ingredient3 )
|
92
|
+
outputFile.write( chef )
|
93
|
+
outputFile.write( "<HR>" )
|
94
|
+
}
|
95
|
+
outputFile.write( "</BODY>" )
|
96
|
+
|
97
|
+
}
|