Get code to run on every column in a table -Error “Could not find a public static method named …”...
Can you take a "free object interaction" while incapacitated?
Reason why a kingside attack is not justified
Why is implicit conversion not ambiguous for non-primitive types?
Is divisi notation needed for brass or woodwind in an orchestra?
Make a Bowl of Alphabet Soup
Showing mass murder in a kid's book
1 John in Luther’s Bibel
Is there a POSIX way to shutdown a UNIX machine?
C++ lambda syntax
Did I make a mistake by ccing email to boss to others?
Extract substring according to regexp with sed or grep
Sort with assumptions
Checking @@ROWCOUNT failing
Why do Radio Buttons not fill the entire outer circle?
Asserting that Atheism and Theism are both faith based positions
I keep switching characters, how do I stop?
Started in 1987 vs. Starting in 1987
How to split IPA spelling into syllables
Relations between homogeneous polynomials
What is the meaning of "You've never met a graph you didn't like?"
"Marked down as someone wanting to sell shares." What does that mean?
New Order #2: Turn My Way
Mortal danger in mid-grade literature
Derivative of an interpolated function
Get code to run on every column in a table -Error “Could not find a public static method named …” -Mapbasic 17
How to loop through all columns in a table/layer getting all data for a row/feature in MapBasic?
I need to run a table update command on every column in a table. The code works fine when I manually define the column to work in but not when it is part of a for loop that gets all the column names I get
If I take the update table command out of the loop and into the code after the for loop, it works fine. What's different with defining a declare in a loop?
'64 bit regex based on https://community.pitneybowes.com/communities/communityhome/digestviewer/viewthread?MessageKey=a92a0fcd-5348-4eae-aa93-a47d5a1e6bbe&CommunityKey=3c2aca7a-c3ae-4602-a142-9ee956769d55&tab=digestviewer#bma92a0fcd-5348-4eae-aa93-a47d5a1e6bbe'
Include "MapBasic.def"
'64 bit regex'
Declare Method RegExReplace Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String, ByVal sReplace As String) As String
Declare Method RegExIsMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As Logical
Declare Method RegExFirstMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As String
Declare Sub Main
Sub Main
Dim inFile, regexString as String
Dim inColumn as Alias
inFile= "Z:My DriveMangoesmappingSpatial Projects2018DSC07_DSC_Asset_Identification_and_GeocodingWorkingPhase3_DataEnrichmentWorkingDataUpdatesScratchWater_Hydrants.TAB"
'Perform Regex and text Replace'
Open Table inFile as tempTable
'Alter Table tempTable (add ScratchField Char(254) ) Interactive
Browse * From tempTable
regexString ="^s|s(.*)"
' Perform on all fields -ref: https://gis.stackexchange.com/questions/75494/how-to-loop-through-all-columns-in-a-table-layer-getting-all-data-for-a-row-feat
Dim sCol As String
Dim aCol As Alias
Dim nCol As Integer
For nCol = 1 To TableInfo(tempTable, TAB_INFO_NCOLS)
sCol = ColumnInfo(tempTable, "COL" & nCol, COL_INFO_NAME)
aCol = tempTable & "." & sCol
'Update every column as it's found --- GIVES ERROR
'Update tempTable Set ScratchField = RegExReplace(aCol,regexString,"")
Next
'Update a known column
inColumn = tempTable & ".As_con_3_hyperlink"
Update tempTable Set ScratchField = RegExReplace(inColumn,regexString,"")
End Sub
mapinfo mapbasic regex
add a comment |
I need to run a table update command on every column in a table. The code works fine when I manually define the column to work in but not when it is part of a for loop that gets all the column names I get
If I take the update table command out of the loop and into the code after the for loop, it works fine. What's different with defining a declare in a loop?
'64 bit regex based on https://community.pitneybowes.com/communities/communityhome/digestviewer/viewthread?MessageKey=a92a0fcd-5348-4eae-aa93-a47d5a1e6bbe&CommunityKey=3c2aca7a-c3ae-4602-a142-9ee956769d55&tab=digestviewer#bma92a0fcd-5348-4eae-aa93-a47d5a1e6bbe'
Include "MapBasic.def"
'64 bit regex'
Declare Method RegExReplace Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String, ByVal sReplace As String) As String
Declare Method RegExIsMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As Logical
Declare Method RegExFirstMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As String
Declare Sub Main
Sub Main
Dim inFile, regexString as String
Dim inColumn as Alias
inFile= "Z:My DriveMangoesmappingSpatial Projects2018DSC07_DSC_Asset_Identification_and_GeocodingWorkingPhase3_DataEnrichmentWorkingDataUpdatesScratchWater_Hydrants.TAB"
'Perform Regex and text Replace'
Open Table inFile as tempTable
'Alter Table tempTable (add ScratchField Char(254) ) Interactive
Browse * From tempTable
regexString ="^s|s(.*)"
' Perform on all fields -ref: https://gis.stackexchange.com/questions/75494/how-to-loop-through-all-columns-in-a-table-layer-getting-all-data-for-a-row-feat
Dim sCol As String
Dim aCol As Alias
Dim nCol As Integer
For nCol = 1 To TableInfo(tempTable, TAB_INFO_NCOLS)
sCol = ColumnInfo(tempTable, "COL" & nCol, COL_INFO_NAME)
aCol = tempTable & "." & sCol
'Update every column as it's found --- GIVES ERROR
'Update tempTable Set ScratchField = RegExReplace(aCol,regexString,"")
Next
'Update a known column
inColumn = tempTable & ".As_con_3_hyperlink"
Update tempTable Set ScratchField = RegExReplace(inColumn,regexString,"")
End Sub
mapinfo mapbasic regex
add a comment |
I need to run a table update command on every column in a table. The code works fine when I manually define the column to work in but not when it is part of a for loop that gets all the column names I get
If I take the update table command out of the loop and into the code after the for loop, it works fine. What's different with defining a declare in a loop?
'64 bit regex based on https://community.pitneybowes.com/communities/communityhome/digestviewer/viewthread?MessageKey=a92a0fcd-5348-4eae-aa93-a47d5a1e6bbe&CommunityKey=3c2aca7a-c3ae-4602-a142-9ee956769d55&tab=digestviewer#bma92a0fcd-5348-4eae-aa93-a47d5a1e6bbe'
Include "MapBasic.def"
'64 bit regex'
Declare Method RegExReplace Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String, ByVal sReplace As String) As String
Declare Method RegExIsMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As Logical
Declare Method RegExFirstMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As String
Declare Sub Main
Sub Main
Dim inFile, regexString as String
Dim inColumn as Alias
inFile= "Z:My DriveMangoesmappingSpatial Projects2018DSC07_DSC_Asset_Identification_and_GeocodingWorkingPhase3_DataEnrichmentWorkingDataUpdatesScratchWater_Hydrants.TAB"
'Perform Regex and text Replace'
Open Table inFile as tempTable
'Alter Table tempTable (add ScratchField Char(254) ) Interactive
Browse * From tempTable
regexString ="^s|s(.*)"
' Perform on all fields -ref: https://gis.stackexchange.com/questions/75494/how-to-loop-through-all-columns-in-a-table-layer-getting-all-data-for-a-row-feat
Dim sCol As String
Dim aCol As Alias
Dim nCol As Integer
For nCol = 1 To TableInfo(tempTable, TAB_INFO_NCOLS)
sCol = ColumnInfo(tempTable, "COL" & nCol, COL_INFO_NAME)
aCol = tempTable & "." & sCol
'Update every column as it's found --- GIVES ERROR
'Update tempTable Set ScratchField = RegExReplace(aCol,regexString,"")
Next
'Update a known column
inColumn = tempTable & ".As_con_3_hyperlink"
Update tempTable Set ScratchField = RegExReplace(inColumn,regexString,"")
End Sub
mapinfo mapbasic regex
I need to run a table update command on every column in a table. The code works fine when I manually define the column to work in but not when it is part of a for loop that gets all the column names I get
If I take the update table command out of the loop and into the code after the for loop, it works fine. What's different with defining a declare in a loop?
'64 bit regex based on https://community.pitneybowes.com/communities/communityhome/digestviewer/viewthread?MessageKey=a92a0fcd-5348-4eae-aa93-a47d5a1e6bbe&CommunityKey=3c2aca7a-c3ae-4602-a142-9ee956769d55&tab=digestviewer#bma92a0fcd-5348-4eae-aa93-a47d5a1e6bbe'
Include "MapBasic.def"
'64 bit regex'
Declare Method RegExReplace Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String, ByVal sReplace As String) As String
Declare Method RegExIsMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As Logical
Declare Method RegExFirstMatch Class "WindowHelper.Controller" Lib "WindowHelper.dll" (ByVal sInput As String, ByVal sPattern As String) As String
Declare Sub Main
Sub Main
Dim inFile, regexString as String
Dim inColumn as Alias
inFile= "Z:My DriveMangoesmappingSpatial Projects2018DSC07_DSC_Asset_Identification_and_GeocodingWorkingPhase3_DataEnrichmentWorkingDataUpdatesScratchWater_Hydrants.TAB"
'Perform Regex and text Replace'
Open Table inFile as tempTable
'Alter Table tempTable (add ScratchField Char(254) ) Interactive
Browse * From tempTable
regexString ="^s|s(.*)"
' Perform on all fields -ref: https://gis.stackexchange.com/questions/75494/how-to-loop-through-all-columns-in-a-table-layer-getting-all-data-for-a-row-feat
Dim sCol As String
Dim aCol As Alias
Dim nCol As Integer
For nCol = 1 To TableInfo(tempTable, TAB_INFO_NCOLS)
sCol = ColumnInfo(tempTable, "COL" & nCol, COL_INFO_NAME)
aCol = tempTable & "." & sCol
'Update every column as it's found --- GIVES ERROR
'Update tempTable Set ScratchField = RegExReplace(aCol,regexString,"")
Next
'Update a known column
inColumn = tempTable & ".As_con_3_hyperlink"
Update tempTable Set ScratchField = RegExReplace(inColumn,regexString,"")
End Sub
mapinfo mapbasic regex
mapinfo mapbasic regex
asked 4 mins ago
GeorgeCGeorgeC
2,89332980
2,89332980
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316048%2fget-code-to-run-on-every-column-in-a-table-error-could-not-find-a-public-stati%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f316048%2fget-code-to-run-on-every-column-in-a-table-error-could-not-find-a-public-stati%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown