Is there any way to move the negative to the left side on DataPrep? - google-cloud-dataprep

I have this DataFrame which was exported from SAP, and it comes with the negative numbers like these
a b c
0 1 2- 3-
1 4- 5 6
2 7 8- 9-
Is there any way to move the (-) sign to the left side on Google Cloud DataPrep?

Few ways of doing that, let's cover a simple one -
Using find-replace transformation, with grouping :
{number} is Trifacta pattern for any kind of number (int\dec)
({number}) saves this pattern as "group 1", later reference at the "replace" field.
We're just deleting the suffix "-", and adding one of our own at the beginning.
Notice that by "trying to find the minus suffix" we're making sure we're not adding a minus where it's not needed.

Related

FileMaker auto-generate buttons and fields for all/some fields of the record?

I'm writing a data-sync/merge solution in FileMaker where I have two data sources and compare/merge them.
That means I have a number of tables and each with a number of fields.
I have for a testing field built my logic and a layout so that FM shows me when the local and remote data source are different and shows me two buttons to let me choose which data to merge into the other set.
I could, of course, manually replicate all the formulas and buttons for all fields in all tables, but that would be insane. Is there a way to tell FileMaker "use this layout and script steps on the buttons for all fields, changing the names of the fields as you go" ?
Or, in other words, I have two fields and two buttons. Let's call them DataA::field and DataB::field. I have a layout that shows them side-by-side. That layout has two buttons with attached logic to show the buttons only if the field values are different. Button A has a "single step" formula that says "set field value of B to A" and button B has a formula "set field value of A to B".
Is there a way to replicate those buttons and their logic to all the fields in my table without doing a lot of manual work ?
The answer is YES!
You need...
fmWorkMate
[Makes your FileMaker work]
fmWorkMate is a free Power Toolbox for FileMaker Developers from www.mrwatson.de (that I have written over the last 10 years or so).
I use fmWorkMate myself to do exactly what you are doing! In my case I'm syncing fields between tables of my FileMaker solution and embedded ESS tables, but the process is the same... make one field / bit of code... and then automatically generate ('multiply') the rest.:-)
So, how?
First up download and install fmWorkMate - This is actually the trickiest part of the process, since the latest version is yet to be published (and I will correct this once published)
If you use Mac OS < Catalina you can download the fmWorkMate Bundle from the downloads page
If you use Windows you'll need to download the old Windows version from the downloads page
If you have anything else, or have any troubles, contact me, and I'll get the tool out (at last) or to you (at least)
Here are several examples to illustrate how you can use fmWorkMate to do what you wish:
The above here does not answer the question directly, rather shows how to replace fields A and B with fields C and D.
The examples are nonetheless useful and illustrative as they stand, and the techniques build on each other.
I have added example 4 as the full answer to the question below.
Example 1: From your two Buttons with A and B, create two similar buttons with C and D
In Theory:
Copy your buttons out of FileMaker (CMD+C / ctrl+c)
Convert the FileMaker objects to editable XML with fmCheckMate
Open fmCheckMate
Open fmWorkMate
Choose the fmCheckMate tool (or press CMD+2 / ctrl+2)
Press the button [Convert Clipboard FM ⭤ XML]
Or press CMD+2 / ctrl+2
Or press CMD+OPT+C / ctrl+alt+c)
And if you are not automatically changed to the XML editor view...
Press the edit button (or CMD+3 / ctrl+3) to change to the XML-Edit view
Or set up fmCheckMate to always switch to the XML editor:
fmCheckMate > Settings... > XML editor > Small editor)
Find and Replace text in the XML as needed
Replace field A with field C
Click in the [F]ind field (or press CMD+F / ctrl+F)
Type the name of the field you want to change A
Click in the [R]eplace field (or press TAB or CMD+SHIFT+F / ctrl+shift+F)
Type the name of the field you want to change to C
Replace all occurrences:
Press CMD+OPT+A / ctrl+alt+A
Or (on newer versions of fmCheckMate) Press the [R] button
Or (on older versions of fmCheckMate) Hold ALT and press the [R] button
Replace field B with field D
Repeat with B and D
Convert back to FileMaker objects
Press the [-> FM] Button (or press CMD+OPT+V / ctrl+alt+V)
Paste into FileMaker (CMD+V / ctrl+V)
Voilá!
(Or rather - oops - did we break it?)
In Practice:
For the particular example you have given - using only one-letter field names A and B - the above will break the XML and not work - because the search and replace is across the entire XML, and the letters A and B appear in various places throughout the XML and replacing them will make the XML unreadable.
However, 99.9% of the field names you will actually be replacing will be quite unique and it is turns out to rarely be a problem.
For example, if your fields were named Previous value and Current value and you wanted to change them to Previous event and Current event that would be no problem at all.
Note, however, that just replacing value with event would (probably) break the XML as well, since value is (highly likely) the name of an XML attribute too. In general: Avoid using single word search words like name, id, Layout,.
[And, of course, the table names DataA and DataB would work fine as they are unique/non-conflicting with XML tag and element names.]
Example 2: Multiply a bit of code for multiple fields
Let's say you have a list of 10 fields you want to sync:
CustomerName
Company
Street
HouseNumber
City
ZIP
Country
Item
Quantity
UnitPrice
How can we produce code for these 10 fields in a fraction of the time?
Write the code for your first field
Multiply your code
How?
First prepare fmTextMultiplier:
Start fmTextMultiplier
Open fmWorkMate
Choose the fmTextMultiplier tool
If necessary press [New] (CMD+2 / ctrl+2) to get an empty record
Paste your field list into the empty Replace field
=> Note: The first line appears in the search field
Press the button [Don't duplicate original]
=> The first line is removed from the replace field
=> fmTextMultiplier is ready to go:-)
Then
Create some code for field 1 - e.g. the field named CustomerName
Multiply the code
Copy the code out of FileMaker (CMD+C / ctrl+c)
Paste the XML into fmTextMultiplier
Click in the fmTextMultiplier Text field
Select Edit > Paste FileMaker Clipboard -> XML (or press CMD+ALT+V / ctrl+alt+V)
Click [Multiply Text x Values] (or press CMD+5 / ctrl+5)
Click [-> FM] (or press CMD+6 / ctrl+6)
Paste your code back into FileMaker
Check + tweak your code as necessary
For example, you might want to correct the field data types.
The best thing is, this same method works for field definitions, layout-fields, buttons, script steps, scripts, whatever!
Once you have set up fmTextMultiplier once you can use the same multiplier function to multiply all the different bits of code around the fields.:D
Example 3: Generating a Series of Fields
Say you are building a calendar and need a series of fields to hold the days:
Day 1
Day 2
Day 3
Day 4
Day 5
Day 6
Day 7
Day 8
Day 9
Day 10
Day 11
Day 12
Day 13
Day 14
Day 15
Day 16
Day 17
Day 18
Day 19
Day 20
Day 21
Day 22
Day 23
Day 24
Day 25
Day 26
Day 27
Day 28
Day 29
Day 30
Day 31
Day 32
Day 33
Day 34
Day 35
Day 36
Day 37
Day 38
Day 39
Day 40
Day 41
Day 42
Gee, this is going to be hard work!
Nope!
We shall use fmTextSeries to generate the series automatically and fmTextMultiplier to multiply the Day 1 code.
Generate the list (series) of field names you need using fmTextSeries
Start a fresh fmTextSeries
Open fmWorkMate
Choose fmTextSeries tool
Press New if necessary
Enter the following values into the dialog and press OK
Text: Day 1
Times: 42
Ìncrement: 1
=> The series is already on your clipboard, ready to paste!
Prepare fmTextMultiplier
Go back to fmWorkMate (via the standard 'back' navigation):
Click the mrwatson logo
Or press CMD+1/ ctrl+1
Start a fresh fmTextMultiplier
Choose the fmTextMultiplier tool
Press New to start a new multiplication
Paste the generated field names into the Replace field
Choose [Don't duplicate original]
Multiply your code as in Example 2 above
And repeat for any other such fields - or indeed for any code you need (e.g. Day 1 Event Summary field, Calendar Reset script, Calendar picker layout, ...)
Example 4: Changing direction of Set Field[ DataA::field ; DataB::field ]
So,...
You have a script step (or a button with a script step - or even multiple buttons/steps) that sets 'field A' to 'field B' (or, in your case, a field in table DataA to a field in DataB)...
And you want to change the direction?
Easy! Use a fmCheckMate XSLT transform to swap the source and target fields around!
How?
Additionally to fmWorkMate and fmCheckMate (see above) you'll need the fmCheckMate XSLT library:
This is in the fmWorkMate Bundle from the downloads page
Or can be downloaded from MrWatson's fmCheckMate-XSLT GitHub repo
Once you have copied the fmCheckMate XSLT folder to your documents folder:
Copy the buttons (or script steps)
Convert to XML using fmCheckMate (see above)
Press the [T]ransform button
If this is the first time using fmCheckMate-XSLT the library is loaded
Note: In some (old?) Versions of the library + tool you may see loading errors here - these can be ignored as they are caused by some badly formatted XSLT files, that have no bearing on the further procedure here.
Find and perform the desired transformation
Either in list view
Browse to or find the Swap Set Field Target And Value function
Clicking the function name performs the function
Note:
Clicking other fields filters the list, so you can reduce the list to browse by
Clicking Change to show only Change functions
Clicking Script step to show only the Change Script step functions
Clicking the headers sorts the column
Or in tree view
Click [Change]
Click [Change > Script steps]
Click [Change > Script steps > Swap]
Click [Change > Script steps > Swap > Set]
-...
Click [Change > Script steps > Swap > Set > … > … > Value]
You can change views with the [View] button
Convert the XML back to FM
Paste into FileMaker
Lol! The direction has been magically changed!
Example 5: Multiplying code using TWO separate field lists
You haven't asked for this directly, but this example may save you having to ask another question.
If your FileMaker-fields and SQL-fields have slightly different names, fmTextMultiplier can deal with that too.
Say you have these FileMaker fields (in your DataA table)
CustomerName
Company
Street
HouseNumber
City
ZIP
Country
Item
Quantity
UnitPrice
And these SQL fields:
customer_name
company
street
house_number
city
zip
country
item
quantity
unit_price
And on your layout you have the two fields with labels next to each other:
CustomerName [CustomerName] customer_name [customer_name]
You can multiply these using fmTextMultiplier by using two columns:
First, you need the two columns separated by tabs (or whatever)
CustomerName customer_name
Company company
Street street
HouseNumber house_number
City city
ZIP zip
Country country
Item item
Quantity quantity
UnitPrice unit_price
Set up fmTextMultiplier like this:
Start fmTextMultiplier
Opn fmWorkMate
Choose fmTextMultiplier tool
Press [New] to start a fresh new Multiplication
Paste the above text into the Replace field
Set the Split Values # char/textfield to {{TAB}} (or your chosen delimiter)
Choose [Don't duplicate original]
Then you can multiply your code in four easy steps
Copy your code in FileMaker
Multiply it in fmTextMultiplier - as described above
Paste it into the Text field
Click in the field
Select Edit > Paste FileMaker-Clipboard -> XML
Click [Multiply Text x Values]
Click [-> FM]
Paste the code back into FileMaker
Organise the multiplied objects in your layout
OK, so step 4 is not that easy because all of the multiplied layout objects end up in a big pile on top of one another, which is a real pain to pull apart - if you started with 4 separate layout objects, that is.
On the other hand, if you...
Group the layout objects together before you copy them
You can then just
Paste the pile of objects into FileMaker
Align them horizontally and vertically on top of the original group of objects
Click somewhere to deselect the new objects
Click on the top object
Move it down the layout to the correct position
You can calculate the position = orig_top + height_between_rows * (total_number_of_rows-1)
Select all the objects - including the original one
Choose Arrange > Distribute > Vertically
Et voilá... all the rows are in exactly the correct position!
Example 6 - fmTextConverter
There is an also a tool for performing multiple conversions to a text, fmTextConverter.
So If you have some code that operates on your FileMaker-fields, and you want the same code to do the same to your SQL-fields, you can simply
Set up fmTextConverter
Open fmWorkMate
Open fmTextConverter
Press [New] to create a new text Conversion
Paste the FileMaker-field-names in the Search field
Paste the SQL-field-names in the Replace field
Then
Copy your code out of FileMaker
Convert with fmTextConverter
Paste your code into the Text field as XML
Edit > Paste FileMaker Clipboard -> XML
Press [Convert text now]
Press [-> FM]
Paste it back into FileMaker
Note: If one of your field names is a substring of another field name then the substitution will go wrong, if the substring is converted first.
fmTextConverter highlights this problem and offers a sort button, which sorts longer strings to the top, ensuring that the substring is never converted first!
Note too that fmWorkMate is highly optimised for efficient batch work - there are lots of keyboard shortcuts and settings to make repetitive work efficient.

How do I set two different words to be equal in beyond compare 3

I'm trying to diff different versions of a program. The older version uses 1 and 0 to represent true and false while the new version uses the words true and false. Since these boolean values are everywhere, most of the file is 'different.' For now I've added 1,0,false,and true to unimportant in a custom file type, but this has a few unfortunate side effects (like not matching a 1 that changed to false.) So, does anyone know how to make true match to 1 and false to 0?
edit:
The language is a proprietary one for my company, but it's relatable to sql. An example of what I mean would be
select *
from fake_table ft
where ft.active_ind = 1
becomes
select *
from fake_table ft
where ft.active_ind = true
If you have a Beyond Compare 3 or 4 Pro license, you can use Replacements in the Text Compare to show the differences as a match. Replacements are a pro only feature, if you have a BC3 or BC4 Standard license, then you'll have to use unimportant text.
In the Text Compare, click the Rules toolbar button (referee icon).
Go to the Replacements tab. Click New (BC3) or + (BC4).
Text to find: 1
Replace with: True
After you define the replacements, 1 on the left matched with True on the right will be colored as a match if View > Ignore Unimportant Differences is on.

Number and letter numbering of tables in word with cross-referencing

How do I get a smart numbering system as shown below? Whenever I have a new table, I want the numbering to rise.
If, on the other hand, I add a row to the table, I would like to add a letter in behind the numbering.
Is this possible?
I have startet using Field Codes and Sequences, and I believe it is the way to go.
I know the numbering without the letters can be obtained by
Number #{ STYLEREF 1\s}{SEQ Table \# "00"}
I also know that alphabetic numbering can be made by using the \alphabetic command.
I am just not sure how to combine them. Also, I would like to make cross-references to the table captions.
You can achieve this with Word's built-in numbering - no need to resort to a complex combination of fields that you'll need to manually update.
I'm going to outline the very complete approach...
On the Home tab: Paragraph/Multilevel list/Define new list style.
Enter a name for the style, then from the Format button choose Numbering; click More.
With Level 1 selected, choose the style with which you want to link the numbering (Heading 1, for example)
In the "Enter formatting for number" field type any text you want to have appear before or after every number. (According to your picture: Header in front of the number 1 with grey shading already in the box.)
Select Level 2, choose the style with which you want to link the numbering (Heading 2, for example)
In the "Enter formatting for number" field type in front of the number (2, grey shading): Number #00
From the "Include level number from" dropdown, select level 1. The number from Level 1 will be inserted between the last 0 and the grey-shaded 2.
If necessary, change the alignment settings (you probably don't want the indent inside the table cell?)
Now, when you apply the Heading styles the numbering will be applied automatically. If you don't like the formatting of the Heading styles you can change the style definition(s). Since you created a numbering style, you can also change these settings by going again to the Multilevel numbering dialog box, right-clicking the numbering format you created and selecting "Modify".
I believe the following field code approach will give you the numbering indicated in your sample image (where the table numbering restarts for each Heading 1 paragraph. However, it will probably only work for "in-line" tables, not floating tables or tables in text boxes and so on.
The main aim here is to ensure can insert exactly the same field codes for each new "Number#" that you need, but to achieve that you also have to put some codes at the beginning and end of each table. You will also need to select and re-execute all the field codes twice to ensure that they are updated properly - this is the kind of disadvantage that Cindy Meister's Answer mentions.
At or before the beginning of each table, put the following fields. (If you are already putting a table caption before each table, you could do this slightly differently.)
{ SEQ tbl \s 1 \h }{ SEQ ltr \r0 \h }
This increments the table number, resetting at each Heading 1 paragraph, and resets the letter number to 0.
For every "Number #" you want in a table, use the following fields:
Number #{ STYLEREF 1 \s }{ SEQ tbl \c #00 }{ SEQ ltr \h }{ IF { REF "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" } > 1 "{ SEQ ltr \c \*alphabetic }" "" }
This inserts the appropriate Heading number and the table number, and increments the letter number. It then looks at a bookmark that contains the number of "Number #" entries in this table. For example, if Heading 1 is numbered 4, and this is the thrid table under that heading, the bookmark will be called "chap1tbl4". If the bookmark's value is greater than 1, the appropriate letter will be appended.
But we have to create that bookmark and value, which we can only do after all the "Number #" fields for that table. So at the end of each table, or immediately after the table and before any new Heading 1 paragraph, you will need the following field codes:
{ SET "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" { SEQ ltr \c } }
The thing is that Word evaluates field codes in the sequence they appear in the document. So when Word first encounters the { REF } field in the table, the bookmark will have no value. So the first time you select all the fields and execute them, you may see the wrong answer. After you have done that, the bookmark is created. Word will use the value most recently assigned to the bookmark, so the next time you execute the "Number #" fields, they should work properly.
I think to achieve what you wanted using the general approach given in Cindy Meister's Answer, you would need to have two separate Heading levels, one for the Numbers without letters,and another for the numbers with letters. The user, or some VBA (say) would then have to decide for each table which Heading level to use. But even if that is the case (and she may have something else in mind), it may still be an operationally simpler approach than the field-based one. I suspect only you are in a position to decide.
There may be a simpler field-based formulation, but IME the basic problem is that you cannot test the "final value" of a SEQ or SET field, only the value it has at the point of execution. For example, if there was a \f flag that let you test the final value of a SEQ field, you could use
{ IF { SEQ "chap{ STYLEREF 1 \s }tbl{ SEQ tbl \c }" \f } > 1 .... }
to test the number of "Number #" entries in each table, without having to have that awkward end-of-table SET field.

Excel: Check if Cell value exists in Column, and return a value in the same row as match but different column

In a single workbook i have 2 worksheets named Master and Software.
I want to search a range of cells in column F of Software and IF the value '1' exists in it AND IF 'Software' column B has a text value of 'Antivirus', I want to return to 'Master' the cell value of 'Software' column F FOR THE ROW THAT MATCHES THE VALUE 1.
I tried this but i get errors that i can't debug:
=IFERROR(INDEX($Software!F$7:$Software!F$1000,MATCH(1,$Software!A$7:$Software!A$1000,0),1),"no match")
Anyone see what i'm doing wrong please?
It's like a steering wheel down my pants - driving me nuts.
Thanks
Does the value '1' you are seeking change based on data in Master?
Can you move columns around in the Software tab?
vlookup might provide an easier solution.
As a sample mockup for the 'Software' tab:
Row Software Number
1 test 1
2 test 3
3 AntiVirus 1
4 AntiVirus 2
5 test 4
Then a forumla on Master to pull back Row 3 that would match your question would be:
=INDEX(Software!A:A,MATCH(1,(Software!B:B = "AntiVirus")*(Software!F:F=1),0))
***Important, when you put this in the cell, to get Excel to evaluate it as an array you must press CTRL + Shift + Enter
This will add { } around the function when viewed in the forumla bar.

Replace a number in Netbeans editor with incrementing number

I have some code in Netbeans 6.1 editor that looks like this
fooString(8)
fooString(8)
fooString(8)
fooString(8)
foostring2(8)
foostring3(8)
foostring4(8)
foostring5(8)
foostring6(8)
foostring7(8)
foostring7(9)
foostring7(10)
foostring7(11)
foostring7(12)
and i want to convert it to
fooString(1)
fooString(2)
fooString(3)
fooString(4)
foostring2(5)
foostring3(6)
foostring4(7)
foostring5(8)
foostring6(9)
foostring7(10)
foostring7(11)
foostring7(12)
foostring7(13)
foostring7(14)
Is there a way e.g with regular expresions or anything else to do the job?
Thank you
Do you want to do this programmatically? If not, then I'd do the following
Use regular expression to insert a tab around the number so (8) becomes (\t8\t)
Copy this to an Excel sheet. The tab would arrange the numbers in a separate column i.e. excel will look something like this.
A B C
foostring( 8 )
foostring1( 8 )
foostring2( 8 )
etc.
Now change the values in column B. Just type 1 and 2 in the first 2 rows and drag down to fill the rset of rows.
Copy back to netbeans editor and remove the tabs inserted in step 1.