Get Rownum Attribute as a Transient Attribute in Oracle ADF - oracle-adf

I have a requirement, in which the code is using a SQL as
Select <COLUMN_LIST>, ROWNUM from <TABLE_LIST_AND_WHERE_CLAUSE>;
Now i need to remove this ROWNUM from the Select list but still keep the functionality of the attribute.
I have tried forums but with no fruit.
Please suggest is i can use an EL or an attribute to do the same.
Thanks in advance

Will adding #{vs.index + 1} for getting row number in your table solve your problem . vs would be your varStatus attribute value in <af:table> ?

You can't get the value of a column from nowhere. If you remove the ROWNUM from the select query you can not get its values anymore. If you just want to have an attribute called ROWNUM as transient, you can give a certain value to it from EL but however not the original column name, unless you get that value from a SELECT in another place and put it there. But why do you want to have it removed at all? If you don't want to get it displayed anywhere you can change its Display property to FALSE and you should be fine.

Related

Cannot extract year from createdDate in SOQL query

SELECT House__r.Name, House__r.House_Owner__r.person__r.Email__c, (SELECT Name, Total_Balance__c, Total_Expense__c FROM Expenses__r Where Type__c='Yearly' AND AND CALENDAR_YEAR(CreatedDate) = CALENDAR_YEAR(System.today() ) FROM Member__c
Error=> Unknown parsing error.
Kindly suggest what else can I do.
You have two 'AND' in a row. Also, if you are using query editor, you can't use System.today().
(on mobile, formatting will be poor, sorry)
SOQL supports only "field - operator - value_or_function” style for conditions. You try to make it "function - operator - another function", won't work.
For your particular scenario try with WHERE Created date = THIS_YEAR. It's a special literal, see https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_dateformats.htm
More generic way would be to write what you need as a formula field, you could compare to YEAR(TODAY()). (that could be poor performance to filter by formula, often it results in full table scan, you would have to test, maybe add more filters using indexed columns...).
Or write it as WHERE CreatedDate >= :start AND CreatedDate <= :stop, put right bind variables for your range.

Numeric value 'abc_0011O00001y31VpQAI' is not recognized in Snowflake

(Opening the following on behalf of a Snowflake client...)
When I try to insert into the table it threw below error:
Numeric value 'abc_0011O00001y31VpQAI' is not recognized
Have check the table DDL and found only 3 columns defined as NUMBER and rest as VARCHAR.
I checked the SELECT query and didnot find any string value in those NUMBER Datatype columns. Also tried searching in all the Varchar columns for the value 'abc_0011O00001y31VpQAI' , I didn't find any
I know one thing Snowflake doesn't always shows correct error. Am I missing anything here? Is there any way to fix it?
Both COL4_MRR and COL5_QUANTITY are NUMBER
INSERT INTO TABLE
(COL1_DATE, COL2_CD, COL3_CUST_NAME, COL3_LOC_NAME,COL4_MRR,COL5_QUANTITY)
SELECT
'2019-10-03' AS COL1_DATE ,
'AE' AS COL2_CD
,CUSTOMER_NAME AS COL3_CUST_NAME
,LOCATION_NAME AS COL3_LOC_NAME
,MRR_BILLED as COL4_MRR
,QTY_BILLED as COL5_QUANTITY
FROM SCHEMA.V_TABLEA
union all
SELECT
'2019-10-03' AS COL1_DATE ,
'BE' AS COL2_CD
,CUSTOMER_NAME AS COL3_CUST_NAME
,LOCATION_NAME AS COL3_LOC_NAME
,NULL as COL4_MRR
,QTY_BILLED as COL5_QUANTITY
FROM SCHEMA.V_TABLEB
I created a table_D same as original TABLE and tried inserting into it , it worked fine . Then Inserted into Original TABLE from table_D , it worked again .
Deleted those rows from original TABLE and reran the job , it worked fine.
There was no issue with data as all was Number only, I even tried with TRY_TO_NUMBER too. It inserted the data without any changes to the code.
...............
Client is currently waiting on a next day run to re-test to determine if this is either a bug or an issue with their data. In the meantime, we are interested to see if anyone else has run into similar challenges and have a viable recommendation. THANK YOU.
The error typically means you are trying to insert non-numeric data (like 'abc_0011O00001y31VpQAI') into a numeric column. It seems like the customer did everything right in testing and TRY_TO_NUMBER() is a great way to verify numeric data.
Do the SELECT queries run fine separately? If so, then I would check whether there might be a potential mismatch in the datatype of the columns and make sure they are in the right order.
I would also check whether or not the header is being skipped in the file (that may be where the 'abc_0011O00001y31VpQAI' is coming from since the customer did not see it in the data).
SELECT queries work fine, I tried creating a new table with same DDL as original and tried loading into that new table, it worked fine. Not sure why it is not loading into the original table

MS ACCESS Report - Using CODE to change a value in a field from an OPTION Group to a different value

I have a report in ACCESS that Is based on a query of a table populated by a form with an Option group. ( to try to explain this better - Table is inspector qualifications, the query pulls all of the qualifications for the inspector, the qualifications are selected via option group on a form that populates the fields of the inspector qualification table.) Of course, the choices are stored as numeric values, "1, 2, 3 or 4" in the table, but 4 actually designates a N/A or NONE. Since everything is already built out this way, I am trying to write a code that will run when the report is generated (or opened,) that will take the "4" value entered (if the field equals that) and change it to a Null value /blank in the report - not in the query or table. I still want this report to generate everything else as is - show all records - just change the value if that particular option is the one shown in that field for that particular record.
Anyone know of a good way to do this? Any help would be GREATLY appreciated!!!!
You would just place an 'IIF' in the query that tests for the value you want to change, then either changes it to something else, or retains the original value. The below will test field 'Nbr1' for the presence of a 4, and if found, change it to 'N/A', otherwise it stays the same.
Note! You will need to change the control source in the report to reflect the name you provide (i.e. 'MyChange') because you can't keep the original name.
SELECT Table1.ID, Table1.EMPID, Table1.TestResult,
IIf([Nbr1]=4,"N/A",[Nbr1]) AS MyChange, Table1.Nbr2
FROM Table1;

How to get rid of the #func! appearing in a query table in ms access?

I created a field called Expr1 in a query to extract a particular string using the mid function from another field called HOME_CARD.
This HOME_CARD field has data like for example:
IA1234
IA6787
KL8900
MH5689
This is what I've tried to extract only the IA portion in my Expr1 field and it works.
Expr1: Mid([HOME_CARD],InStr(1,[HOME_CARD],"IA"),2)
My issue is, I am getting the #func! error in my query results besides the data like:
KL8900
MH5689
In MS Excel I could handle this issue by using an IFERROR in front of my formula so where IA is not found, the cell would just be blank.
Please help me friends, I rather want my query result for those without IA to be blank(empty) than return a #func!
Thank you in advance.
You can use Left:
Expr1: IIf(InStr([HOME_CARD],"IA")=0,Null,Left([HOME_CARD],2))

How to differentiate between 2 drop downs having similar ID (with changing only last 3 digits) on the same page?

In my application in one of the create screen i have 2 drop downs having similar ID as below:
1st drop down ID: j_idt129_label
&
2nd drop down ID: j_idt147_label
Now i want to select a value from the first dropdown.
One way is By considering the XPATH without considering the dropdown's ID.
Is there any other way for this?
I think this would work for you. This will select the first dropdown:
(//select[contains(#id, 'j_itd')])[1]
To find the second one:
(//select[contains(#id, 'j_itd')])[2]
select is the tag I'm guessing is in your HTML, but you may need to update select to match the actual tag.
Are the drop down ID's (three digits) are keep on changing? If not, then you can directly use them, else, consider corresponding parent element and get its child (drop down) elements.

Resources