Dynamic Counter
I have a results page that lists different records. Each
record has a link to the detail page. Can I and how do I track how
many times a record has been viewed on the detail page? I would say
I'm between a novice and average when it comes to CF, so please
speak slowly : )
you will likely need to add a field to your db table, say
call it
"viewcount", datatype: integer, default value: 0.
then on the page that displays the record details add an
update query to
increment the viewcount value by 1:
<cfquery name="updatecounter" datasource="yourdsnhere">
UPDATE mytable SET viewcount = viewcount + 1 WHERE recordid =
<cfqueryparam cfsqltype="cf_sql_integer"
value="#URL.recordid#">
</cfquery>
NOTE: i have assumed you are passing the recordid to the
details page as
a url variable. change the above query as necessary.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Similar Messages
-
Dynamic count of the metrices for last 3 quarters + current quater.
Hi ,
In one of our report we want to calculate the count of a metric for last 3 quarters + current quater. But the problem here is that we want to generate the dynamic count.
for eg:
report now should show total count for quarter 10Q4,11Q1,11Q2,11Q3. when the 11Q4 come then the count sholud be from 11Q1 to 11Q4 and so on..
Please note that we have a server variable curr_qtr for caculating current quarter.
Appreciate your help.
ThanksThanks,
the issue has been resolved by making a repository variable for last year quarter and then taking both current quater and last year quater varibale in the report filter. -
Dynamic Counter in BEx Report to count the drilldown line item.
Hi,
I have a requirement to show the count of different parts in a report. For example the report,
Part Number Costs
100 200 $
and if you drill down from the part number to line item details, you will get,
Item Number Costs
10 50 $
20 50 $
30 50 $
40 50 $
So basically Part Number 100 is consists of 4 Item numbers. Now I want to show original report like this,
Part Number Costs Counter
100 200 $ 4
Is there any way I can catch that counter, like how many line item is there per Part Number ?
I am thinking of 2 ways, Virtual key Figure to calculate this or in alternate if possible use the Classification extractor (not sure if it possible to count the number of items per classification extractor though).
Is there any better or simpler way to deal this without changing the cube structure ?
Thanks for your time spent on this,
Kind Regards,
ArpanHi,
You can get this functionality with Virtual Key figures.
You will have the complete dataset in the RSR00002 Enhancement in CMOD.
Thank you
Arun -
Dynamic Counts in Discoverer .. Possible ?
Hi All,
Is it possible to do counts in a discoverer worksheet based on the result set returned after we select some parameters.
For example:
Emp Names : emp1,emp2,emp3,emp4,emp5...
Department : 10,20,30,40..
Manager : mgr1,mgr2,mgr3...
Result set for parameter emp um = emp1,emp2,emp3
emp dept mgr
emp1 10 mgr1
emp1 20 mgr2
emp2 30 mgr1
emp2 40 mgr2
emp3 10 mgr1
emp3 20 mgr2
emp3 30 mgr3
i want to display counts of emp grouped by Department, counts of emp grouped by Mgr....how can i do it ?
I tried using sheet2 for just the counts but i donot know how to get these independednt counts after the result gets populated based on the selected parameters. ??
Any help would be highly appreciated...This is my top outstanding issue and need to get back to business ASAP.
Thanks,
VjHi Tamir,
If i have to create these counts in a different worksheet, how can i accomplish it ?
I mean i have never used the option of "same parameters for all worksheets" while setting up the parameters.
I mean my first sheet will have the following...
Result set for parameter emp num = emp1,emp2,emp3
emp dept mgr
emp1 10 mgr1
emp1 20 mgr2
emp2 30 mgr1
emp2 40 mgr2
emp3 10 mgr1
emp3 20 mgr2
emp3 30 mgr3
Second Sheet woulkd look like
dept cnt
10 2
20 3
30 5
Sheet three woulkd look like
Mgr Cnt
Mgr1 2
Mgr2 4
Mgr3 5
Based on the same result set of sheet one i need only these calculations/counts in the second sheet as a summary sheet.
Can you let mw know how to do that in detail please ?
If we can get these summary counts into one sheet it would be great but i donot know if it is possible ?
Displaying these calculation in sheet one along with details would be diffcult for the user to understand as
there will be so many records and they donot want the count to be displayed so many times..
So i made them understand that i can give them the counts in a different sheets only.
But i am still not clear how to do this..!!
Please Advice.
Thanks,
Vj -
I have a scenario where the target field of one idoc segment should get populated ie. field should count how many other different segments are generated in the target.for example
segment A comes to 2 times then say field of segment C should be 2 in the targetYou can use the following UDF's for increment and initialisation of the counter
Increment the Global Variable Counter
public String incrementCounter(String a,Container container){
//write your code here
if(a.equals(" "))
Object o = container.getGlobalContainer().getParameter("CNTR");
Integer ii;
if( o == null ) ii = new Integer(0);
else ii = (Integer)o;
ii = new Integer( ii.intValue() + 1);
container.getGlobalContainer().setParameter("CNTR", ii);
String temp = ii.toString();
return temp;
else return " ";
<b>Intialise the Counter</b>
Object o = container.getGlobalContainer().getParameter("CNTR");
Integer ii = new Integer(0);;
container.getGlobalContainer().setParameter("CNTR", ii);
return "1"; -
Updating dynamic counter variable
I have a form that populates form fields with database
records to edit.
This works fine.
When i attempt to loop through the records to update i get an
error.
Obviously it has to do with my syntax of my variables (
LowerQty='form.LowerQty#count#',
UpperQty='form.UpperQty#count#',
Price=form.Price#count# WHERE id='form.id#count'# )
When i attempt to update the database. It is attempting to
enter the string
value "lowerQty1" rather that it actual intger value=1. What
is the correct
syntax to write these variables in cold fusion? Thanks in
advance.
<!----form------>
<cfset count=0>
<form name="form2"
action="pricecode_adjust.cfm?stage=update"
method="post">
<table width="600" border="1">
<cfoutput query="PriceCodes" startrow="1"
maxrows="#pricecodes.recordcount#">
<cfset count=#count#+1>
<tr>
<td width="100px">Price Code:
#pricecode# <input name="id#count#" type="text"
value="#pricecodes.id[count]#" /></td>
<td width="100px">Lower Qty#count#:
<input type="text" name="LowerQty#count#" size="6"
maxlength="6"
value="#pricecodes.lowerqty[count]#" /> </td>
<td width="100px">Upper Qty#count#:
<input type="text" name="UpperQty#count#" size="6"
maxlength="6"
value="#pricecodes.upperqty[count]#" /></td>
<td width="100px">Price#count#: <input
type="text" name="Price#count#" size="6" maxlength="6"
value="#pricecodes.price[count]#" /></td>
</tr>
</table><input name="Update" type="submit"
id="Update"
value="Update Price Code" />
<!-----store the loop count in hiiden field---->
<input name="recordcount" type="hidden"
value="#pricecodes.recordcount#" />
</cfoutput>
</form>
<!----update------>
<cfif stage eq 'update'>
<!---Loop through pricecodes to be updated--------->
<cfloop index="Count" from="1"
to="#form.recordcount#">
<cfquery name="query" datasource="#client.dsn#"
username="#client.username#" password="#client.password#">
UPDATE cost
SET
LowerQty='form.LowerQty#count#',
UpperQty='form.UpperQty#count#',
Price=form.Price#count#
WHERE
id='form.id#count'#
</cfquery>
</cfloop>
</cfif>if you have tried looking for an answer first, you would have
found it
in this very forum only 2 threads before yours!
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=13 28096&enterthread=y
and another one only 4 before yours!!!
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=13 28004&enterthread=y
and there was another one earlier today on exactly the same
subject!
and don't forget to RTFM:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Part_3_CFML_Ref_1.html
hth
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com -
Creating a list with a dynamic counter
I have a dataProvider that looks like this.
<dataProvider>
<Array>
<Object>Apples</Object>
<Object>Oranges</Object>
<Object>Bananas</Object>
<Object>Limes</Object>
</Array>
</dataProvider>
I want to be able to display those items in a list with a counter like...
1. Apples
2. Oranges
3. Bananas
4. Limes
What is the best way to go about doing this?Hi Cootis,
Hope this is the best way possible to acheive it...
<?xml version="1.0"?>
<!-- Simple example to demonstrate the PieChart control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" height="100%" width="100%">
<mx:Script>
<![CDATA[
]]>
</mx:Script>
<mx:XML id="myXml" xmlns="">
<dataProvider>
<Array>
<Object>Apples</Object>
<Object>Oranges</Object>
<Object>Bananas</Object>
<Object>Limes</Object>
</Array>
</dataProvider>
</mx:XML>
<mx:List id="myList" dataProvider="{myXml.Array.Object}">
<mx:itemRenderer>
<mx:Component>
<mx:Label>
<mx:Script>
<![CDATA[
public override function set data(value:Object):void
super.data = value;
text = (listData.rowIndex + 1) + ". " + value;
]]>
</mx:Script>
</mx:Label>
</mx:Component>
</mx:itemRenderer>
</mx:List>
</mx:Application>
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari -
Dynamic sub-topic slide counter in Captivate 7
Hi, I was wondering if anyone could give me guidance on the following routine that i would like to implement using Captivate 7.
I would like a front-end menu selector slide to dynamically count how many slides are allocated to each of the sub-topics so that it can 'show' when all slides have been completed topic by topic.
I envisage puting a pre-loaded topic selector onto my master slide, so that when you load a new slide into the filmstrip, you would choose from a 'dropdown' as to which topic this slide belongs (this dropdown would not be visible in runtime)
This way, when i enter the package in runtime, I can use the system variable to count how many slide are in the total package, but when i get to the menu slide, it will have dynamically counted how many slides are alloctaed to each topic before i enter the topics. Once the total amount of slides allocated to a topic have been completed, the menu button will indicate this.
It is the sub-topic dynamic counting part of this query that i am having trouble with.
Thank you in advance for any assitance you can provide on this matter.
CraigHi Lilybiri,
OK, Captivate has a system variable that calculates how many slides are in a total package, but, for example, my package is broken down into sub-topics of:
Colours
Animals,
Cars
Flowers
etc ....
When I am developing the content and I add a new slide from my Master template, there will be a dropdown menu (not visible in runtime) from which I select which topic this new slide belongs to (ie Colours, Animals, etc ......). So I can do this for all new slides added to my package. (Probably a variable set for each slide which will be 'Slidetopic = Colours' or 'Slidetopic = Cars')
When I finally run the package, I will have a 'Menu' slide where I can choose which sub-topic I want to visit, but I wan Captivate to dynamically count how many slides are there allocated to 'Colours', how many are set to 'Animals', etc, etc .....
This way I can then determine exactly when I have completed the 'Cars' topic and change the menu button to indicate this fact.
Upon initial entry, I would suspect my menu screen will display information such as:
Total slides = 40
Colours = 12 slides
Animals = 8 slides
Cars = 14 slides
Flowers = 6 slides
It is the dynamic counting of the sub-topic quantity where I am hoping that someone may help me.
Does this make my ambitions any clearer Lilybiri ?
Thank you for your interest.
Best wishes,
Craig -
Count not updating when counting table rows (after adding one)
following this code from this link:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/479cbc96-6ec2-4d9f-b2f8-a2b43a09111e/html-client-dynamically-count-records-in-a-collection-on-browse-screen?forum=lightswitch
I have got my screen to count how many rows are present when the screen first loads. In my scenario I have a add button located on the bottom navigation bar. this opens up a dialog window where the user can add the relevant information. However when the
user hits save, and is navigated back to the browse screen, the count still displays the previous value. If i was to refresh the page it updates but this is not what i am after, when i navigate back i want the value to add by one, am i missing something in
this code?
screen.ExpanderLines.addChangeListener("state", function() {
screen.countExp = screen.ExpanderLines.data.length;
thanks for any helpTry this:
screen.ExpanderLines.addChangeListener("count", function () {
screen.countExp = screen.ExpanderLines.count;
Dave
Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer. -
hi folks,
i'm new to flash and need some help finding a dynamic
count-up clock. it would work opposite to the coundown time clocks
that are popular in various websites. i need count up from a past
date and time and continue indefinetely. i found a file that has
the look but not the functionality at:
http://www.flashkit.com/movies/Animations/Anime/Characters/flip_cou-wellcrea-9983/index.ph p
any help or a steer in the right direction will be much
appreciated.
adamI MADE A SIMPLE CLOCK USING JAVA.
IT IS RUNNING WHENEVER I BOOT MY MACHINE.AS I PUT IT
IN TO THE STARTMENU PROGRAM.
BUT THE PROBLEM IS IT MAKE A TASKBAR ICON(THE ICON
WITH COFEE CUP).
SO I'M ABLE TO CLOSE IT USING THAT.
I WANTED TO ELEMINATE THEABILITY TO CLOSE IT
ACCIDENTLY.
SO NOW I'M USING A FRAME WHICH DO NOTHING ON CLOSE.
I USED METHOD.
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOS
); BUT IT TAKE SOME SPACE IN TASKBAR AND DISTURB TO MY
WORK.
AND IT WILL MINIMIZE AN MAXIMIZE IF IT CLICK.
I ALSO TRIED WITH FOLLOWING CODE
this.setImageIcon(null);BUT NOTHING HAPPENED.
I THINK THE ONLY WAY TO OVERCOME THIS PROBLEM IS
REMOVING TASKBAR ICON.I HAVE SEEN PROGRAMMES WHICH ARE
RUNNING WITHOUT TASKBAR ICON(EX:-TURBO NOTE+). BUT I
DON'T KNOW HOW TO DO IT..
MY QUESTIONS ARE
1.IS IT POSSIBLE TO REMOE TASKBAR ICON WITH JAVA OR
ANY OTHER METHOD.???(IF POSSIBLE PLEASE GIVE ME
EXAMPLE CODE OR A PLACE TO TAKE EXAMPLE)
2.IS THERE ANOTHE METHODS TO OVERCOME FROME THOSE
PROBLEMS?
PLEASE THINK I'M NEW TO JAVA AND ALSO NEW TO COMPUTER
SCIENCE.This is offensive - unglue your caps-lock and re-write this please: it gives me a headache just to look at it -
Each cell Navigation/drill down
INPUT METHODS-------- REJECTED---------------ACCEPTED
A--------------------------------- 12-------------------------34
B--------------------------------- 16-------------------------21
C--------------------------------- 10-------------------------4
D--------------------------------- 1--------------------------18
Each cell has to provide drilldown option. These Rejected/Accepted values are dynamically counted from database.IF the user clicks on a particular Rejected value (eg. 12 or 16), I need to list those 12 or 16 records breakup for each cell .
Thanks
chandrahi
Create an Hierarchy where the Input method value be the parent level set the dimensional value as the logical level key and then set the Rejected and accepted as the child level in the same level and define accepted and rejected both as logical key in the same level
Check the drilldown box
Regards
Debo -
Need help with SQL retrieval for previous month till current date
Hi ,
Need help generating statistics from previous month from date of enquiry till current date of enquiry.
and have to display it according to date.
Date of enquiry : 03/02/2012
Application Type| 01/01/2012 | 02/01/2012 | 03/01/2012 |...... | 31/01/2012 | 01/02/2012 | 02/02/2012 | 03/02/2012 |
sample1 20 30 40
sample 2 40 40 50
sample 3 50 30 30
Hope you guys can help me with this.
RegardsHi,
932472 wrote:
Scenario
1)If i run the query at 12 pm on 03/2/2012. the result i will have to display till the current day.
2)displaying the count of the application made based on the date.
Application type 01012012 | 02012012 | 03012012 | ..... 01022012| 02022012|03022012
sample 1 30 40 50 44 30
sample 2 35 45 55
sample 3 36 45 55Explain how you get those results from the sample data you posted.
It would help a lot if you posted the results in \ tags, as described in the forum FAQ. {message{id=9360002}
SELECT application_type as Application_type
, COUNT (CASE WHEN created_dt = sysdate-3 THEN 1 END) AS 01012012 (should be getting dynamically)
, COUNT (CASE WHEN created_dt = sysdate-4 THEN 1 END) AS 02022012
, COUNT (CASE WHEN created_dt = sysdate-5 THEN 1 END) AS 03022012
, COUNT (CASE WHEN created_dt = sysdate-6 THEN 1 END) AS 04022012
FROM table_1
GROUP BY application_type
ORDER BY application_typeThat's the bais idea.
You can simplify it a little by factoring out the date differences:WITH got_d AS
SELECT qty
, TRUNC ( dt
- ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
, -1
) AS d
FROM table1
WHERE dt >= ADD_MONTHS ( TRUNC (SYSDATE, 'MON')
, -1
AND dt < TRUNC (SYSDATE) + 1
SELECT SUM (CASE WHEN d = 1 THEN qty END) AS day_1
, SUM (CASE WHEN d = 2 THEN qty END) AS day_2
, SUM (CASE WHEN d = 62 THEN qty END) AS day_62
FROM got_d
See the links I mentioned earlier for getting exactly the right number of columns, and dynamic column aliases. -
EXECUTE IMMEDIATE in Pro*C
I am trying to use Execute immediate as following.
strcpy (sqlstmt, "select id_tag, desc from notice where id = 2");
EXEC SQL EXECUTE IMMEDIATE :sqlStmt INTO :id_tag, :desc;
Pro*C is not letting me do INTO, while same thing works in PL/SQL fine.
Any Idea on how to do this, other option for me is declare a cursor and do a FETCH INTO.
Thanks in advance.
SandeepIf you wanted it that way, this is one way to do it:
#include <stdio.h>
EXEC SQL INCLUDE SQLCA ;
EXEC SQL BEGIN DECLARE SECTION ;
VARCHAR sqlstmt[1000] ;
VARCHAR userid[100] ;
int cnt ;
EXEC SQL END DECLARE SECTION ;
int main(void)
strcpy(userid.arr, "scott/tiger") ;
userid.len = strlen(userid.arr) ;
EXEC SQL CONNECT :userid ;
strcpy (sqlstmt.arr, "select count(*) from emp where deptno = :deptno");
sqlstmt.len = strlen(sqlstmt.arr) ;
EXEC SQL EXECUTE
BEGIN
EXECUTE IMMEDIATE :sqlstmt INTO :cnt USING 10 ;
END ;
END-EXEC ;
printf("Count=%d\n", cnt) ;
EXEC SQL ROLLBACK WORK RELEASE ;
}And the output:
D:\>dynamic
Count=3
D:\> -
How do i print out a specific slot of the array created from the following function? I can print them all by putting the dynamic counter varible in the index parameter but if i put a number instead of the dynamic "counter" variable in the index parmeter then the io exception is thrown. this function gets called every time a node in an XML document is encountered. Just printing the same index multiple time would be acceptable as this is just a learning script.
private void showData (String s)
throws SAXException
try {
arr0[numCt]=s;
out.write(arr0[0]);
//out.write (s);
out.flush ();
numCt++;
} catch (IOException e) {
throw new SAXException ("I/O error", e);
}SAX parsing has nothing to do with your array problem. It should not be in your example.
Your example is not small.
It does not compile.
It uses deprecated methods, and you know it does.
You shouldn't even be trying to parse an xml document if you can't iterate over and access data from an array properly. There is a link to the tutorials at the top of the New To Java forums.
Also, from your previous post you don't even know the syntax of this language. You can't just toss a bunch of code into a text document and hope to get something useful.
Also, do not berate people trying to help you and do not demand answers. Your lack of understanding is your own fault not ours. You would be wise to reread posts you don't comprehend, or purchase learning materials to fill the gaps in your knowledge.
Here is a working example with arrays throwing out all the XML garbage that shouldn't even be in your example.
There are two examples: One example uses your swiss army knife method. And the other "better" example uses discrete methods that perform individual functions denoted by their names.
If you continue to be an ass to this forums contributors don't expect answers.
import sun.plugin.dom.exception.InvalidStateException;
public class BooksLibrary {
private int numCt = 0;
private String[] arr0 = new String[100];
public static void main(String argv[]) {
System.out.println("Tour way: \n");
yourWay();
System.out.println("\n\nReasonable way: \n");
reasonableWay();
private static void yourWay() {
BooksLibrary bl = new BooksLibrary();
bl.fillArray();
private void fillArray() {
for(int i=0; i < arr0.length; i++) {
showData("" + i);
System.out.println();
Is this method showing data? yes
Should this method also add data to the array? no
Should this method only show the data in index zero and not the data in the index that was just assigned? no
What is the purpose of this method?
private void showData(String s) {
arr0[numCt] = s;
System.out.print(arr0[0] + " ");
numCt++;
private static void reasonableWay() {
BooksLibrary bl = new BooksLibrary();
try {
bl.showLastAddedData();
} catch (Exception e) {
System.out.println("No Data Added");
try {
bl.showAllAddedData();
} catch (Exception e) {
System.out.println("No Data Added");
for(int i=0; i<5; i++) {
bl.addData("" + i);
try {
bl.showLastAddedData();
} catch (Exception e) {
System.out.println("No Data Added");
try {
bl.showAllAddedData();
} catch (Exception e) {
System.out.println("No Data Added");
//try to add too much data
try {
for(int i=0; i < 1000; i++) {
bl.addData("" + i);
} catch (Exception e) {
e.printStackTrace(System.out);
private void addData(String s) {
arr0[numCt++] = s;
private void showLastAddedData() {
if(numCt <= 0) {
throw new InvalidStateException("No data has been added to array yet");
System.out.println(arr0[numCt - 1]);
private void showAllAddedData() {
if(numCt <= 0) {
throw new InvalidStateException("No data has been added to array yet");
for(int i = 0; i < numCt; i++) {
System.out.print(arr0[i] + " ");
System.out.println();
} -
How to repeat binding dates in header row when tadaset in table must be paginated?
I need to make a form which is filled by XDP file (this file is made by other SW (payroll)).
This form contains table. There are some binded (filled) text fields in a header row and some filled text fields in a body row. (For example - name is in header row, some personal dates are in body row). Body row is dynamic, count of body rows is different for each name.
When the table overflows the page, I need to repeat the header row with name on the second page.
And here is a problem. Header row is repeated, but text field (with name) is empty.
Files for example are : http://www.ulozto.net/soubory/strelenkas/documents/
Thank you very muchloop at ot into wa.
at first header one
write second header.
endloop.
declear one internal table append both values in come internal table .
pass the header in comen internal table.
Message was edited by:
Karthikeyan Pandurangan
Maybe you are looking for
-
Calculation of Tax Depreciation
can u tell me How Can we calculate Tax Depreciation with out posting in Financial Records...for Income Tax Purpose....plz give me the configuration steps and also how can we show in reports,,.... Thanks in Advance.... Suresh
-
Downloading music from a "new" computer
I have an iPod Nano (2nd generation). We have a new computer using Windows 7. I've heard that using a different computer to download music to your iPod can "fry" the iPod. How can I continue to download music to my iPod using my new computer?
-
Download stopped with error = -50
I purchased something on the iTunes store and now the download does not finish. It errors out at 120.1 MB with a status of stopped (err= -50) My internet is working (obviously as I am posting this from it). I have tried the download from my PC and
-
Update 4.1.2 wifi turns off when mobile data is on.
Since the latest update from Verizon whenever I connect to Wifi it connects then drops back to 4G right away. When I turn off the mobile data the wifi will connect again. This was never the case prior to the update.
-
I just got a new Nano 3G a few days ago. Today I got no sound when I hooked the nano up to my cassette adapter. Hmmm. So I tried it at work with my headphones. No sound. Well I read a post here that says to press the center and menu buttons together.