How to use regex to unmatch the line if certain word exists on that line? - regex-lookarounds

I have the following regex
(?!.*internal).*auditor['’s]*.*(?=report)|(?!.*internal)(?<=report).*auditor['’s]*.*
and the following test cases
report of auditor
report of external auditor
auditor external report
in auditor report
auditor report
internal report of auditor
report of internal auditor
auditor internal report
I want to match if there is report before or after auditor['’s]* but I do not want to match if the word internal presents
with my above regex internal report of auditor will be matched.
Here is the desired result
report of auditor
report of external auditor
auditor external report
in auditor report
auditor report
Here is the regex101

The "'s" suffix to "auditor" seems irrelevant, so remove that unnecessary complication.
You requirement can be expressed as:
contains "auditor"
contains "report" (because "before or after something" just means "contains" - the "something" is irrelevant)
does not contain "internal"
Putting that in to regex:
^(?!.*\binternal\b)(?=.*\breport\b).*\bauditor\b.*
I put word boundaries (\b) around the terms, so for example "internalization" and "reporting" aren't matches.
See live demo, showing this matching all but the last 3 lines of your sample input.

Related

Linking quotation and order data in way that lets order data to be flexible

I have developed a data model as per screenshot. The purpose of this is to have all the relevant quotation data "mapped" out for further analysis.
The data between orders/quotations/invoices etc is linked by generating link tables, which comes out directly from SAP document flow (the document flow table only holds main document number, like quotation number and a line number of the material).
The links serve their purpose and are correct, if the quotations weren't so "flexible".
Orders to invoices are linked on a material level, so there cannot be any difference between them.
But Quotations are not hard linked to orders, I'll explain below.
For example if a quotation is created for 2 lines, which then later is converted in to an order, the user is not forced to keep the order in the same structure as the quotation, he/she can add more items in the order/change quantities etc. so they can really only be linked on the header level, aka Document number to document number.
So this is where I need some help.
I have tried to link the quotations to order in 2 ways, but they both have their issues.
Doc to Doc. - The lines are duplicated when trying to create a report at an item level.
Doc + line number to Doc + line number - If the order has extra lines added on to compared to quotation, this data is not captured in the flow.
I am hoping someone had a similar task/issue in the past and would be kind enough to share their experience/approach.
Regards

Condition to supress a field in crystal report

I need a clarification how to suppress rest of field if another any one is satisfied(except the satisfied field others should be suppressed.
Actually the scenario is there is a field table called mode of transport and in that three field should be there
sea
ocean
air
If sea is selected inside that four field should be displayed
bill of lading
shipping number
destination
bill to
So for all the above three there are such sub fields
If one field for ex sea is selected the relevent above four filed related to sea as given should be displayed and rest of fields for air and road should be supressed.
Kindly anyone help me with the condition to solve it sooner.
In the suppress section of the field you want to suppress you can put a condition like that:
{Command.MODE_OF_TRANSPORT} = 'sea'.

sql oracle search by multiple terms in business object report

I am writing a report where i would like the end user to be able to search by multiple terms (ie. UK, CZ)
but my code it does not fetch any results
like #variable('2. COUNTRY (UK, CZ, AT or use % for all)')
It works when just using just one term (ie. UK) but not when the user tries to search for more than one value.
I have tried using different statements before the variable but still get no results.
Is a search like this possible?
I'm writing this for Business Objects 5
Thanks
Matt
You're trying to perform a wildcard search (by using the LIKE keyword) in combination with a prompt (I take it it's a multi-value prompt).
Lets go through a few possible scenarios:
Wildcard
Example: the user enters % in the prompt.
SQL translation: Country LIKE '%'
Result: the query returns all records due to the wildcard
Single-value
Example: the user enters UK in the prompt.
SQL translation: Country LIKE 'UK'
Result: the query returns all records with the Country column matching the value UK
Multiple values
Example: the user selects UK and AT in the prompt.
SQL translation: Country LIKE 'UK,AT'
Result: the query returns no records because there is no record that contains the value UK,AT (literally) for the Country column.
What you're trying to do, as far as I can determine, is to allow the user to select multiple values or skip the selection altogether and return all values (for which you used the combination of the LIKE keyword and % wildcard).
However, with multiple values, you need to use the IN keyword instead. In current versions of BusinessObjects (you're using a very old version), it's possible to make prompts optional.
As you don't have this feature, the only alternative is to create a universe condition in which you build a CASE around your #prompt function, to determine if the user entered a % or selected multiple values and then construct your WHERE clause accordingly.
Have a look at this article for an example how to build such a condition.

Trying to create an APEX Link Column that queries a report

Basically, say I have a report A and I want to add a link column to it, and I set its target to a page in the application...the page its referring to has another report (lets call it B)
Is it possible for me to somehow make it so that table A's link column opens the page with Report B with rows that have the same column value for one of their columns?
Example here:
A
Name Num1 Num2
--------------
A 5 3
B 3 3
C 4 2
B
Name Quantity Serial
--------------------
D 2 3
E 1 8
F 4 6
So if I click the link column for row A, I want it to open report B and only shows rows where its Num2 = Serial, so only row D would show since it is the only one that equals 3
Using Report Linking to Filter Other APEX Report Outputs
I had some fun with this one although. The "A" and "B" stuff was pretty dry, so I decided to create a data set that was more engaging, and perhaps clearer to understand for the rest of us... :) This is how the data-ecosystem was broken down, and the way I fulfilled the OP requirements.
The Test Schema:
Welcome to the manufacturing facilities of the "Recipe Stack" Food Works. The schema design and ERD (Entity Relation Diagram) is below, with the sample data used for this demonstration:
The data relations are as follows:
The staff at the Stack Food-Works keeps an inventory of all ingredients for the types of meals and prepared foods they manufacture. Each ingredient has a unique ID (INGREDIENT_ID) and the staff tracks the amounts of each item in their pantry.
Each ingredient can be used in multiple recipes, but they will be used exactly once for a given recipe.
The ENTREE_RECIPE table has a COMPOSITE KEY which means it is the combination of the two pieces of this composite key (ENTREE_NAME and INGREDIENT_SEQ) that should be unique.
There is a FOREIGN KEY relation between the INGREDIENT_ID values of both tables.
Report Display Requirements (APEX and SQL Design Elements)
Selecting an item from the FIRST report is used as the input and the restriction/filter criteria of the second report.
User Case #1:
User Selects a Ingredient ID from the list of available ingredients in the pantry.
Input from (1) filters output of the RECIPE REPORT. This is a list of all the recipes that have the chosen ingredient in their formula.
User Case #2:
User Selects an ENTREE_NAME from the RECIPE REPORT. The ENTREE_NAME is used to deliver a third report: the RECIPE FORMULA which is the full recipe for the entree item that was selected from the previous report.
Testing Tools
(You usually need these these for the more complex pages, so it's a good start to use or develop them for the easier ones...)
I made my own, but you can also invoke the SESSION link on the developer's tool bar at the bottom of the APEX page on your running application (when it is displayed).
Here's my idea; it's a header region that also has a button to RESET input values so that I can clear the cache and retest or try other examples. I'll show later how you can use this link to see what is going on. You can see it in the discussion of testing at the bottom of this guide.
APEX Report/Page Design and SQL Parametrization
My columnn linking scheme looks similar to the previous post such as the one from FTaveras. This is how my linking works. What's different is that I do not go to another page, I simply go BACK to the same page I came from. Redirects and Branches apparently don't care if they are simply returning to the same location.
What is different on the return trip is that page parameters that were originally null or unpopulated NOW have a value. That value now brings life to the reports on the page that were empty.
Step 1: The PANTRY REPORT
Output: Query all items from the FOOD_SUPPLIES table.
Inputs: Supply links by INGREDIENT_ID to filter the RECIPE_REPORT output.
How to do it: (hint) To accomplish this, define the report column/field value in your report layout design page as a "linked" column and assign its value as a page item. The page item will be referenced in the SQL query of the next report...
Step 2: The RECIPE REPORT
Output: Query all records from the ENTREE_RECIPE table which have the INGREDIENT_ID from Step 1 within their formula.
Input: Supply links by ENTREE_NAME to filter the RECIPE_FORMULA output.
How to do it: (hint) Include the page item defined from Step 1 within the SQL query of this report:
SELECT * FROM entree_recipe
WHERE ingredient_id = :P3_INGREDIENT_ID
Step 3: The FORMULA REPORT
Output: Query all records from the ENTREE_RECIPE table which have the ENTREE_NAME selected from Step 2.
Debug and Test Run
Most will be able to get this far without any problems. If not, here are a couple of examples of how you can debug and test your work. There may be some built-in tools and packages that already exist within Apex, so any suggestions on alternate approaches are welcome in the comments...!
Using the APEX Developer SESSION Output
After selecting the inputs for the trial run, click on the SESSION link on the developer toolbar at the bottom of the page. This is an example output:
Note that the page items that were set for that session are displayed. The inputs I used for this test were:
INGREDIENT_ID: 6432
ENTREE_NAME: peach cobbler (fresh)
Extra Credit: This one is an alternate approach. It may be useful to design something like this as an add-on to any app you design. You do not need to remove it from your app when you push it to production because there is a "conditional display/suppress" feature for page regions. (check it out)
Simply set a global parameter as a "mode" on your Apex app. Set the value to "DEBUG" or "TEST" or whatever and key all your instances of this page region to display only when the global parameter is set to it.
Wrap Up and Discussion
Hopefully, you've enjoyed your visit to the "Stack Food Works" (no tasting or sampling from the line, please).
This has been more of a holistic approach to Apex app design. It helps to have a methodology to map out each step, and a way to check your work at both the beginning and the end of your development process. Using smaller examples like this demo to apply these methods provides a chance to understand Apex development as a Software Creation PROCESS.
Yes it's possible.
On page B, add and hidden Item name for example P(#)_SERIAL where (#) is your current page number.
Modify your query and add one line like AND SERIAL=:P(#)_SERIAL.
On Page A go to "Report Attributes" tab on the report region, click edit.
On the column link section configure your link to page B and set the hidden item on page B to the value on report column of page A.
Name: Item 1 [P(#)_SERIAL] Value: #Num2#
Demo

Making rdlc datasource filter from other datasource

So to summarise the problem, I have a report which has two datasources - and is really two reports stuck to each other. I want the second part of the report to display data based on what the first part of the report is showing.
To go into more detail, the situation is as follows. I have two database tables - lets call one Customers, and the other Orders.
Customers contains data about the customers.
Orders contains a link to customers and contains the person's orders.
The report itself is supposed to display some sort of letter in part 1:
"Hello [CustomerName], you have an ongoing balance of [TotalBalance] bla bla bla..."
and a list of all the orders he has made in part 2
"Order 1: Item 1: 1 euro
Order 2: Item 2: 2 euro ..."
Originally these were two separate reports which we were generating one record at a time, outputting as pdf files and merging them using third party software such that the letter and the list of orders were next to each other. The problem is that this system will need to generate hundreds of them at a time, and it was taking ages. So now I want to pass a pair of large data sources and generate them in batches (call them 600 at a time) - which works faster.
So how can I force the second tablix which uses a different datasource, to filter based on what is in the first tablix with its own datasource?
I've looked at subreports, but they only work using reporting server and these are local reports.
Anything I can do ? I'm worried that its not possible.
There's no reason subreports won't work with local reports.
I recommend you download the samples from this site ReportViewer Samples. The project named "SupplyingData" shows how to load data into a subreport.