In TOTALYTD function is it possible to avoid hard-coding year_end_date?
Suppose you have a fiscal year of 9/30. The TOTALYTD function looks like:
YTD Actual $:=TOTALYTD( [Actual $], 'Date'[Date], ALL('Date'), "9/30")
But I want to avoid hard coding "9/30", and assuming I have a settings table from where I can get a date with the yearend, I tried this:
YTD Actual $:=TOTALYTD ([Actual $], 'Date'[Date], ALL('Date'), DISTINCT( 'Settings'[YearEndDate]))
I get no errors but it calculates like "12/31". I tried to use Format but with no luck.
Is there a way to make this work?
I didn't try it, but I guess a max should work (assuming that there is only one date in the settings table).
YTD Actual $:=TOTALYTD ([Actual $], 'Date'[Date], ALL('Date'), MAX( 'Settings'[YearEndDate])
Can you try it out?
Cheers,
Jason | www.SqlJason.com
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Similar Messages
-
Is is possible to avoid hard-coding the Item in a shared Select List Query?
I created a "Select List" in the Shared Components area as follows:
My goal is to create a shared select list that can be used on any form for a particular Field.
IF :P10_FK_RSTA_CODE is NULL THEN
RETURN
'select col_description, col_code_pk
from CODE_TABLE
where col_active_ind = ''Y''';
ELSE
RETURN
'select col_description, col_code_pk
from CODE_TABLE
where col_code_pk = :P10_FK_RSTA_CODE';
END IF
Which works great, but how can I make the select list work for the same column on a different form?
Because :P10_FK_RSTA_CODE is hard-coded in the function, I can't reuse this Function from a different form.
(I could rename the Field on every form to the same name, but I'm hoping there is a better way.)
Is there a way I can pass in a variable from the Field Item to make this dynamic where I can use it on any form?
Also, I am very new at this, so if there is a better way to do this, I would greatly appreciate any input.
Thanks in advance.
MF>
Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "956902".
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
I created a "Select List" in the Shared Components area as follows:
My goal is to create a shared select list that can be used on any form for a particular Field.
IF :P10_FK_RSTA_CODE is NULL THEN
RETURN
'select col_description, col_code_pk
from CODE_TABLE
where col_active_ind = ''Y''';
ELSE
RETURN
'select col_description, col_code_pk
from CODE_TABLE
where col_code_pk = :P10_FK_RSTA_CODE';
END IF
Which works great, but how can I make the select list work for the same column on a different form?
Because :P10_FK_RSTA_CODE is hard-coded in the function, I can't reuse this Function from a different form.
(I could rename the Field on every form to the same name, but I'm hoping there is a better way.)
Is there a way I can pass in a variable from the Field Item to make this dynamic where I can use it on any form?Reference the value of an application item rather than a page item in the LOV query, setting the value using a process or computation on each form page. -
How to avoid hard coding in Programming
Hi,
For preparing a Sales report we need to fetch Excise, Tax and
Education cess.
While doing the programming condition types of excise, tax and education cess were given to technical consultants.
It is like hard coding the programming. In future if a new condition type is created then it wont be calculated.
What are the ways to avoid hard coding?
regards,
sathyaYou can create a Z-Table that you are using for referencing your data e.g. condition type. This way this is customizable.
In a project I worked before we even had a more sophisticated way for avoiding hardcoding. We had one generic table including Program name, "Function to be exextued" (e.g. determination of condition) and the key value. And we had a function module reading these parameters from the gerneric table. Everytime you would need a specific value from this table you called this table via the function module.This way you had a customizable table and no more hardcoding was needed, the function module provided you with the values. -
Tips on avoiding hard coded paths and make a java app platform independent
HI all,
I would like to gather some tips on how to avoid hard coded file paths, which are plenty in the application I work on and which I inherited from previous programmers.
Also, when deploying to the production server, my app goes from a Windows platform to a Linux machine.
I am curious to know what tricks and tools other programmers find useful in similar contexts.
I am sure many of us would benefit from the discussion.
Thank you !Actually, Java does this for you; you can use unix-style paths and they will still work, even on Windoze. To wit:
public static void main(String[] args) {
File f = new File("/");
System.out.println(f.getAbsolutePath());
}Yields: C:\
public static void main(String[] args) {
File f = new File("/Program Files");
System.out.println(f.getAbsolutePath());
}Yields: C:\Program Files -
Parse schema name - Avoiding hard-coded schema names
Hi all,
I have been trying to find a similar thread but had no luck. I want to avoid hard-coding schema names in my reports. I have tried to use a Substitution string but I don't seem to be able to reference it by just doing :default_schema. I already reference the parsing schema like this: #OWNER# which is saving me a lot of time. Is there any way to create additional variables like that one instead of those substitution strings that can't be parsed in a query?
Thanks a lot for your help.
Regards,
werot.Werot wrote:
I have been trying to find a similar thread but had no luck. I want to avoid hard-coding schema names in my reports. I have tried to use a Substitution string but I don't seem to be able to reference it by just doing :default_schema. I already reference the parsing schema like this: #OWNER# which is saving me a lot of time. Is there any way to create additional variables like that one instead of those substitution strings that can't be parsed in a query?
Will you actually get any benefit from using substitution strings? They are also hard-coded at design time. You could use application items if you need something dynamic.
Bind variable syntax (:default_schema) will not work for lexical substitution of substitution string and application item values in report queries. You have to use static text (&DEFAULT_SCHEMA.) references (and be aware of the potential for SQL injection that this exposes).
I wouldn't recommend using schema qualifiers directly in APEX applications. I would use grants, synonyms and views at the database level. -
How can I avoid hard-coding this where clause in the inner select?
This is extremely fast, but I have to hard-code the inner-most where clause, and I obviously can't do that. I know how to work-around it by creating a function that takes the CUSTOMER_ID and returns the ORDER_ID from the most recent payment, and that's reasonably fast, but I thought it would be worthwhile to see if there was a way to do this in straight SQL. I also know that better design could make the problem go away.
Very much appreciate it if you could take a look and let me know if there's any way to get this kind of performance without hard-coding.
Thanks,
create or replace view customer_view as
select customer.customer_id,
customer.customer_name,
select t.order_id
from (
select payment.order_id
from payment
where payment.customer_id = 1 -- <-- Here's the line where I'm hard-coding the customer_id. Is there any way to reference the customer_id without hard-coding this?
order by payment.payment_date desc
) t
where rownum = 1
) as latest_order_id
from customer
select * from customer_view where customer_id = 1; <-- I want that inner-most select to use this customer_id, without having to hard-code it.Hi Matt,
Something like this could be a possibility (Not tested)
create or replace view customer_view as
select customer.customer_id,
customer.customer_name,
(select min (t.order_id)
keep (dense_rank first order by payment.payment_date desc)
from payment
where payment.customer_id = customer.customer_id)
as latest_order_id
from customer;Regards
Peter -
hello experts,
in one of the requirements i asked to design the selection screen with some of the fields, those fields are having some constant values while filtering the data.
to avoid that hard coding they asked me to design the selection screen with those fields can anyone suggest me how to do that...?
thanks a lot for your anticipation...
SRIhi
good
you can create a f4 search helo,store those hard coded values in a internal table and fetch those interal table value into that f4 help.
thanks
mrutyun^ -
Avoiding hard coding of Font and Signature Path in RTF
Hi All,
I have to create a check printing program and this requires MICR font and signatures. right now i have provided the URL for signature in RTF and path where my font is kept.
The issue is everytime i am migrating my code from one instance to other i have to change both. Is there any way so that i can avoid the hardcoding of both.
Thanks
AryanHi Helios,
Thanks for the help buddy. I have gone through document earlier and here also the path hardcoding has been told. I want to avoid that.
Regarding the Image i am using a standard Report for getting the check details and i don;t want to modify that part for getting the url value from there. I hope there is some other way to resolve this the way oracle uses for it standard reports.
Thanks
Aryan -
How can I avoid hard coding this width?
I have something like this:
<s:SkinnableDataContainer
width="200"
itemRenderer="MyItemRenderer"
dataProvider="{ dp }">
If I have 4 items each 50px wide, I would set the width to 200px.
However, I want to avoid hardcoding the width.
How can I extract the width from the item renderer?You might want to try not setting a width and setting requestedColumnCount on the layout instead.
<s:List>
<s:layout>
<s:HorizontalLayout requestedColumnCount="2" />
</s:layout>
<s:dataProvider>
<s:ArrayList>
<fx:String>0000</fx:String>
<fx:String>1000</fx:String>
<fx:String>2000</fx:String>
<fx:String>3000</fx:String>
</s:ArrayList>
</s:dataProvider>
</s:List> -
This following section:
boolean shownewUserLoc( JRTkNetworkInterface ajrtkNI ) throws LogicError {
System.out.println( "####################################################" );
System.out.println( "# Performing Action: Locations Screen (other User) #" );
System.out.println( "####################################################" );
System.out.println( "\t\t###################" );
System.out.println( "\t\t# LOCATION SCREEN #" );
System.out.println( "\t\t###################\n");
System.out.println( "Available commands:");
System.out.println( "\t\tSEARCH <User Name>");
System.out.println( "\t\tNEXT or PREVIOUS");
System.out.println( "\t\tCLOSE or CLEAR or NEW NAME or AGAIN");
System.out.println( "\t\tSELECT\n\n\n");
return true;occurs several times in my code, for every other boolean type, all this System.out.println stuff is repeated again. I'd say there is a way to in the above instead of all this System.out stuff refer to some txt file where all that is present, thus just let the contents of this txt be printed out?
If so, how does this referring work?You could do it like this:
class YourClass {
boolean shownewUserLoc( JRTkNetworkInterface ajrtkNI ) throws LogicError {
System.out.println(Finals.ERROR);
return true;
class Finals {
public final static String ERROR =
"####################################################\n"+
"# Performing Action: Locations Screen (other User) #\n"+
"####################################################\n"+
// other variables
}, or use a properties file:
http://java.sun.com/docs/books/tutorial/essential/environment/properties.html -
BufferedImage type parameter -- way to avoid hard-coding?
My situation:
I'm creating a new BufferedImage, then populating it with the Graphics of
a component. I'm using the Component's height and width as two of
the paramters, but I also need to specify the type. Right now I've got
TYPE_INT_RGB hard-coded, but I seem to recall this is a Bad Idea.
My question:
Is there a (more) correct way to identify/specify the type when creating my
BufferedImage?
final BufferedImage myImage =
new BufferedImage(myComponent.getWidth(), myComponent.getHeight(),
BufferedImage.TYPE_INT_RGB);
final Graphics2D g2d = myImage.createGraphics();
myComponent.paint(g2d);Hm. I totally missed that method. Unfortunately, I really need a BufferedImage. I'm invoking ImageIO.write() later on, and that requires a RenderedImage, of which BufferedImage is the only implementation.
Thanks, though. I'll definitely keep that method in mind for later! -
BDC transaction "The function is not possible"
Dear Experts,
I have made a BDC transaction program according to recording from SHDB in order to have batch transaction for FB50.
However, when I run the program. It shows an error "The function is not possible". But when I press the "Save" button manually, the function passed and result is saved. Just do not know what happens.
report YFB50 no standard page heading line-size 255.
include bdcrecx1.
type-pools : TRUXS.
data : rawdata type TRUXS_T_TEXT_DATA.
parameters: sfile TYPE localfile default 'C:\fb50.txt'.
parameters: plant like BKPF-BUKRS default '1000'.
data: pfile type string.
data: post_date(8) type c.
data: record_count(2) type c.
data: v_HKONT(19) type c.
data: v_SHKZG(19) type c.
data: v_WRBTR(19) type c.
data: v_SGTXT(19) type c.
data: v_KOSTL(19) type c.
*** DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
* If it is nessesary to change the data section use the rules:
* 1.) Each definition of a field exists of two lines
* 2.) The first line shows exactly the comment
* '* data element: ' followed with the data element
* which describes the field.
* If you don't have a data element use the
* comment without a data element name
* 3.) The second line shows the fieldname of the
* structure, the fieldname must consist of
* a fieldname and optional the character '_' and
* three numbers and the field length in brackets
* 4.) Each field must be type C.
*** Generated data section with specific formatting - DO NOT CHANGE ***
data: begin of record occurs 0,
* data element: HKONT
HKONT(010),
* data element: SHKZG
SHKZG(007),
* data element: WRBTR
WRBTR(017),
* data element: SGTXT
SGTXT(050),
* data element: KOSTL
KOSTL(010),
end of record.
*** End generated data section ***
start-of-selection.
pfile = sfile.
concatenate sy-datum+6(2) sy-datum+4(2) sy-datum+0(4) into post_date.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = pfile
TABLES
DATA_TAB = rawdata
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6
INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.
IF SY-SUBRC <> 0.
WRITE:/ 'SY-SUBRC:', SY-SUBRC.
ENDIF.
CALL FUNCTION 'TEXT_CONVERT_CSV_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR = ';'
I_TAB_RAW_DATA = rawdata
TABLES
I_TAB_CONVERTED_DATA = record
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
perform bdc_dynpro using 'SAPMF05A' '1001'.
*Input header information
perform bdc_field using 'BDC_OKCODE'
'/00'.
*Document Date
perform bdc_field using 'ACGL_HEAD-BLDAT'
post_date.
*Posting Date
perform bdc_field using 'ACGL_HEAD-BUDAT'
post_date.
perform bdc_field using 'BDC_OKCODE'
'/ECCDE'.
perform bdc_dynpro using 'SAPLACHD' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*Company Code
perform bdc_field using 'BKPF-BUKRS'
plant.
perform bdc_dynpro using 'SAPMF05A' '1001'.
*Input header information
perform bdc_field using 'BDC_OKCODE'
'/BU'.
*Document Date
perform bdc_field using 'ACGL_HEAD-BLDAT'
post_date.
*Posting Date
perform bdc_field using 'ACGL_HEAD-BUDAT'
post_date.
*Input item text
loop at record.
*write sy-tabix to record_count.
*concatenate 'ACGL_ITEM-HKONT(' record_count ')' into v_HKONT.
*concatenate 'ACGL_ITEM-SHKZG(' record_count ')' into v_SHKZG.
*concatenate 'ACGL_ITEM-WRBTR(' record_count ')' into v_WRBTR.
*concatenate 'ACGL_ITEM-SGTXT(' record_count ')' into v_SGTXT.
*concatenate 'ACGL_ITEM-KOSTL(' record_count ')' into v_KOSTL.
perform bdc_field using v_HKONT
record-HKONT.
perform bdc_field using v_SHKZG
record-SHKZG.
perform bdc_field using v_WRBTR
record-WRBTR.
perform bdc_field using v_SGTXT
record-SGTXT.
perform bdc_field using v_KOSTL
record-KOSTL.
endloop.
perform bdc_transaction using 'FB50'.
Here is my input:
206090203;H;41.74;abc;MISHK
206090203;H;14.36;abc;FACHK
206100100;S;41.74;def;MISHK
206070100;S;14.36;def;FACHK
Regards,
CatoMake your LOOP.... ENDLOOP... Like this
LOOP AT RECORD.
perform bdc_dynpro using 'SAPMF05A' '1001'.
*Input header information
perform bdc_field using 'BDC_OKCODE'
'/00'.
*Document Date
perform bdc_field using 'ACGL_HEAD-BLDAT'
post_date.
*Posting Date
perform bdc_field using 'ACGL_HEAD-BUDAT'
post_date.
perform bdc_field using 'BDC_OKCODE'
'/ECCDE'.
perform bdc_dynpro using 'SAPLACHD' '1000'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
*Company Code
perform bdc_field using 'BKPF-BUKRS'
plant.
perform bdc_dynpro using 'SAPMF05A' '1001'.
*Input header information
perform bdc_field using 'BDC_OKCODE'
'/BU'.
*Document Date
perform bdc_field using 'ACGL_HEAD-BLDAT'
post_date.
*Posting Date
perform bdc_field using 'ACGL_HEAD-BUDAT'
post_date.
*Input item text
**loop at record.
*write sy-tabix to record_count.
*concatenate 'ACGL_ITEM-HKONT(' record_count ')' into v_HKONT.
*concatenate 'ACGL_ITEM-SHKZG(' record_count ')' into v_SHKZG.
*concatenate 'ACGL_ITEM-WRBTR(' record_count ')' into v_WRBTR.
*concatenate 'ACGL_ITEM-SGTXT(' record_count ')' into v_SGTXT.
*concatenate 'ACGL_ITEM-KOSTL(' record_count ')' into v_KOSTL.
perform bdc_field using v_HKONT
record-HKONT.
perform bdc_field using v_SHKZG
record-SHKZG.
perform bdc_field using v_WRBTR
record-WRBTR.
perform bdc_field using v_SGTXT
record-SGTXT.
perform bdc_field using v_KOSTL
record-KOSTL.
**endloop.
perform bdc_transaction using 'FB50'.
ENDLOOP.
Now should work fine.. -
Is it possible to avoid duplicate material in Sale order creation
Dear SD gurus
Is it possible to avoid material duplication in va01 sale order creation. For amendment purpose the marketing user making new line item with amended qty instead of quantity change. kindly advise me to solve the problem.
Thanks & Regards
R.UdayakumarHI,
There's no alternative to user disciplibe . Business reqt are sometimes like this only
what you can do is use exit mv45afzz in saels order and put coding logic . this will surely work.
{Removed by Moderator}
regards
Edited by: Lakshmipathi on Aug 29, 2009 6:13 PM -
In the numbers app, using the "date and time" function, is it possible to remove the time? I need to put together a list of dates, but I don't need or want times.
When formatting your column to date/time, pick Date & time, and then pick the letter i in the circle to the right. Then scroll down and pick "No time"
Jason -
Regarding error 1601 - is it possible to avoid having to do a "restore" entirely ?
Also if i have to do a restore, i have windows 7- do i follow the steps for Windows XP?
Many thanksI'd refer to this
http://support.apple.com/kb/TS3694 (talks about security software and this error)
and this
http://support.apple.com/kb/HT1414
I've had Windows 7 for a while, but it seems the steps in iTunes are identical.
Maybe you are looking for
-
Create separate reservation for supplement to a CS-order
Hey We have a system where by the formation of CS orders automatically generated a reservation (Using IWxx). Attributed to several components of the order, will supplement get same reservation number as the original warrant. This is inappropriate bec
-
Macbook freezes when connecting external display
I have tried to connect my MacBook to an external monitor, a ViewSonic VA1912wb, but the MacBook freezes each time I try. There is no opportunity to go to System Preferences with the display attached. Has anyone got an idea how to deal with this? Mac
-
Java.lang.NullPointerException in EBS General forum
The EBS General discussion General EBS Discussion returns the following error on the 5th or 6th thread : An error in the system has occurred. Please contact the system administrator if the problem persists. type: java.lang.NullPointerException java.l
-
I can't work camfrom for iTunes for windows please help me
Please tell me how to access camfrog from my PC using I tune programe Thank you.
-
Hello there I want to know that Oracle Application server support which version of the servlet, jsp and JDBC drivers. Thanx in advance Regards Sunny null