Wednesday, October 20, 2021
Tip of the Day: Search and Replace Code within Form EEPs
Product.......: R:BASE Plugin Power Pack X.5 (Version 10.5)
Build.........: 10.5.4.11007 or higher
Sections......: Plugins
Keywords......: RSearchAndReplace, Search, Replace, Form, EEP
With this Tip of the Day, I would like to say "Happy 3rd Birthday!"
to R:BASE X.5!!
Did you know that you can use the RSearchAndReplace plugin to search
and replace text within form EEP code?
The below example demonstrates the ability to search and replace raw
data (EEPs and controls) for database forms.
In order for the code to work, please be sure of the following:
. Connect to the RRBYW20 sample database
. Ensure the form is "not" compressed
. Install and activate the Plugin Power Pack X.5
-- Start of Code
-- Replaces "rbase.com" with "rbase.net" in the
-- RRBYW20HelpAbout sample form
SET VAR vSysData VARBIT = NULL
SET VAR vNewSysData VARBIT = NULL
SET VAR vResult TEXT = NULL
-- Grab the raw form data
SELECT SYS_DATA INTO vSysData FROM SYS_FORMS3 WHERE SYS_FORM_NAME
= 'RRBYW20HelpAbout'
-- Place the form data in a file
WRITE .vSysData TO FormData.txt
-- Use RSearchAndReplace plugin to search/replace the value
PLUGIN RSearchAndReplace vResult +
|FILE_NAME FormData.txt +
|OLD_PATTERN rbase.com +
|NEW_PATTERN rbase.net +
|REPLACE_ALL ON +
|IGNORE_CASE ON +
|WHOLE_WORD OFF
-- Create a temp table
CREATE TEMP TABLE FormDataTemp (RawFormData VARBIT)
-- Load the form data into the temp table
LOAD FormDataTemp
['FormData.txt']
END
-- Grab the updated raw form data
SELECT RawFormData INTO vNewSysData FROM FormDataTemp WHERE LIMIT = 1
-- Update the original form with the new form data
UPDATE SYS_FORMS3 SET SYS_DATA = .vNewSysData WHERE SYS_FORM_NAME
= 'RRBYW20HelpAbout'
CLEAR VARIABLES vResult,vSysData,vNewSysData
PAUSE 2 USING 'Done!'
CLS
RETURN
-- End of Code
Please note:
The results are not 100% reliable, as the data may be wrapped and the
search may miss instances.
Very Best R:egards,
Razzak.
R:BASE Technologies, Inc.
https://www.rbase.com
--
For group guidelines, visit
http://www.rbase.com/support/usersgroup_guidelines.php
---
You received this message because you are subscribed to the Google Groups "RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rbase-l/0LZggk-1n02ha1wia-00lSI5%40mrelay.perfora.net.