How do you use a variable as a field on a Webfocus report? - webfocus

I have a report in which I have the current date stored in a variable, and I want to include it as field on the report. I tried this:
-SET &WORKDATE = AYMD(&YYMD,0,'I8YYMD') ;
-SET &SAVEDATE=EDIT(&WORKDATE,'99999999$');
.....
.....
BY
'&SAVEDATE' AS 'Date Rpt Run'
I also tried:
BY
&SAVEDATE AS 'Date Rpt Run'
Both give me
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: 20140430
BYPASSING TO END OF COMMAND
What is the proper syntax for including a variable in the report? Output of the report is Excel, if that matters.

How about you try
-SET &BYTODAY = &YYMD;
DEFINE FILE TABLE1
BYDATE/I8YYMD = &BYTODAY;
END
TABLE FILE TABLE1
...
BY BYDATE
...

Related

Can kettle export BLOB data from a oracle table?

I have a oracle table where I have columns like Document (type BLOB), Extension ( VARCHAR2(10) with values like .pdf, .doc) and Document Description(VARCHAR2
(100)). I want to export this data and provide to my customer.
Can this be done in kettle ?
Thanks
I have a MSSQL database that stores images in a BLOB column, and found a way to export these to disk using a dynamic SQL step.
First, select only the columns necessary to build a file name and SQL statement (id, username, record date, etc.). Then, I use a Modified Javascript Value step to create both the output filename (minus the file extension):
outputPath = '/var/output/';
var filename = outputPath + username + '_' + record_date;
// --> '/var/output/joe_20181121'
and the dynamic SQL statement:
var blob_query = "SELECT blob_column FROM dbo.table WHERE id = '" + id + "'";
Then, after using a select to reduce the field count to just the filename and blob_query, I use a Dynamic SQL row step (with "Outer Join" selected) to retrieve the blob from the database.
The last step is to output to a file using Text file output step. It allows you to supply a file name from a field and give it a file extension to append. On the Content tab, all boxes are unchecked, the Format is "no new-line term" and the Compression is "None". The only field exported is the "blob_column" returned from the dynamic SQL step, and the type should be "binary".
Obviously, this is MUCH slower than other table/SQL operations due to the dynamic SQL step making individual database connections for each row... but it works.
Good luck!

Getting error while printing xls report for odoo 10

I am using Odoo10 and I'm getting following error while print xls report " Sheetname 'A8', with case ignored, is already in use.: (, Exception(u"Sheetname 'A8', with case ignored, is already in use.",), ) ". So, how to solve this problem?
My code is below:
Python:
from odoo.addons.report_xlsx.report.report_xlsx import ReportXlsx
class PartnerXlsx(ReportXlsx):
def generate_xlsx_report(self, workbook, data, partners):
for obj in partners:
report_name = obj.name
# One sheet by partner
sheet = workbook.add_worksheet(report_name[:31])
bold = workbook.add_format({'bold': True})
sheet.write(0, 0, obj.name, bold)
PartnerXlsx('report.res.partner.xlsx',
'res.partner')
Xml:
<odoo>
<data>
<report id="partner_xlsx"
model="res.partner"
string="Print to XLSX"
report_type="xlsx"
name="res.partner.xlsx"
file="res.partner.xlsx"
attachment_use="False"/>
</data>
</odoo>
Please make sure you don't have the name A8 more than once in partner table.
If the same name exists more than once try either below methods.
Use sheet name as a combination of partner name and code.
Use python try and exception method. If an exception occurs, then change the name.
For your reference:
DuplicateWorksheetName
Python Exceptions

Passing only the required rows of data from CSV file to Jmeter based on a criteria

I have a csv file which has the input in the below format (It has no headers as first row):
India,QA,1200,
India,QA1,1201,
India,QA2,1202,
USA,Dev1,5580,
USA,Dev2,5580,
AUS,Dev3,3300,
AUS,Dev4,3301,
I have configured the CSV Data Set Config component and have given the respective path and variable name details. Snapshot below:
from the command line argument, i will be invoking the Jmeter jmeter.bat -t C:\Users\Dev\Desktop\JI\testscript.jmx -JCountry=Indiawhich also has a parameter called JCountry=India.
Now, I have to use this value (India) and then search the csv file's first column and if it matches, I need to send only those particular rows matching to the country name given from the cmd to the script.
I thought of using If Controller but how can I check the csv files first row and when there is a match, send those details to the script.
You need to loop through CSV, see example or other examples.
As the second example use in while condition the variable from CSV: ${Country} .
Inside loop you need to add If Controller with condition to compare country variable against country property:
${__jexl3("${__P{Country}" == "${Country}")}
Checking this and using __jexl3 or __groovy function in Condition is advised for performances
The easiest option would be dynamically generating a CSV file with only India lines
Add setUp Thread Group to your Test Plan
Add Test Action sampler to the setUp Thread Group (this way you won't have an extra result in .jtl file)
Add JSR223 PreProcessor as a child of the Test Action Sampler
Put the following code into "Script" area:
String country = props.get('Country')
def originalCsvFile = new File('C:/Users/Dev/Desktop/JI/JVMDetails/Details.txt')
def countryCsvFile = new File('C:/Users/Dev/Desktop/JI/JVMDetails/Country.txt')
countryCsvFile.delete()
originalCsvFile.eachLine {line ->
if (line.startsWith(country)) {
countryCsvFile << line
countryCsvFile << System.getProperty('line.separator')
}
}
Configure your CSV Data Set Config to use C:\Users\Dev\Desktop\JI\JVMDetails\Country.txt as this file will have only those lines which start with what you have defined as Country property
More information:
Apache Groovy - Why and How You Should Use It
Groovy Goodness: Working with Files

How to identify specific text from file upload

I have created a function to read row by row from a .txt file which is received from html.
Now I need to filter out things that are not needed and it will be inserted into an array.
How do I create a (if else statement) to recognize certain text?
Example between [info] echo:1080 and [info] Executing: |echo | ${result} | |
I like to get the identifer to recognize [info] echo:1080.
in first you must crawled in text and fetch all of [info] tags in text and push theme in array and with a foreach loop you can analys the code ,
e.g : in foreach you getting :
foreach($array,$item)
{
...
}
$item=echo:1080
in above you can explode $item with ':' character
$item=explode(':',$item);
now you have 2 value that one is an string and other one is executing command for e.g 'echo'
then you must use 'eval' function to execute you code
$command=$item[0].' '.'"'.$item[1].'"';
eval($command);
i hope this solution will be help you

FoxPro - DAO syntax to UPDATE table from another table

Am having problems trying to run a simple UPDATE from another table on FoxPro 2.5 tables, using VB6 and DAO. But am baffled, as I can find no syntax for this which is accepted.
I am trying to UPDATE a field in file TEST.DBF with the value of a looked up code in file JOBS.DBF.
This code generates error 3075 "Syntax error (missing operator) in query expression 'jobs.rcode FROM test INNER JOIN jobs ON test.jobcode = jobs.code'.":
Dim dbsWork As Database
Dim qrd As DAO.QueryDef
Dim szSqlString As String
Set dbsWork = OpenDatabase(szWorkDir, False, False, "FoxPro 2.5")
szSqlString = "UPDATE test SET test.mask = jobs.rcode FROM test INNER JOIN jobs ON test.jobcode = jobs.code "
Set qrd = dbsWork.CreateQueryDef("", szSqlString)
qrd.Execute
Set qrd = Nothing
Set dbsWork = Nothing
What syntax should I use please?
Try using correlated query like this
UPDATE test
SET mask = (SELECT rcode FROM jobs WHERE code = test.jobcode)
WHERE jobcode IN (SELECT code FROM jobs)

Resources