Retrieve variable value from local Storage and display on canvas
Hi
I'm working on a project that has multiple html files (the projects are split into 12 so 12 different edge projects and im linking them via window.open()). I have a variable that keeps track of correct answers stored in LocalStorage html object. I have managed to get the localStorage variable to increment up by one each time the object is correct however my last step is to get the variable and them display the result on the canvas. I have tried
var outPut localStorage.getItem(' ') method to retrieve the variable then used the set and get method to display the result however it doesn't work. Im not sure if I need a for loop to go though the localStorage and get the elements
Code:
// insert code to be run when the composition is fully loaded here
yepnope({nope:['jquery-ui-1.10.0.custom.min.js','jquery.ui.touch-punch.min.js'],complete: init}); // load the jquery files
sym.setVariable("myScore", 0);
var c = localStorage["myCount"] || 0; //loading from localStorage
function init(){
sym.getSymbol("barLimit").$('scrubber').draggable({start: function(e){
},drag: function(e,ui){ // start: ... // Find original position of dragged image
var leftLimitScrubber = sym.getSymbol('barLimit').$('scrubber').position().left; // position of the scrubber
var rightLimitScrubber = sym.getSymbol('barLimit').$('leftLimit').position().left;
var LimitTwoLeft = sym.getSymbol('barLimit').$('rightLimit').position().left;
if(leftLimitScrubber == rightLimitScrubber){
sym.getSymbol('correctBar1').play('in'); //
sym.getSymbol('nextButton').play('in');
sym.getSymbol('incorrectBar1').play('out'); //
sym.getSymbol('thumbsDown1').play('out'); //
sym.getSymbol('thumbsUp1').play('in'); //
sym.getSymbol('congrats').play('in'); //
localStorage["myCount"] = parseInt(c)+1; //Converting string to number, and then saving it
console.log("numberOfCorrectAnswers", localStorage["myCount"]);
var finalScore = sym.getVariable("myScore");
finalScore = c;
sym.setVariable("myScore", finalScore);
sym.$("Score").html(finalScore);
} else if(leftLimitScrubber == LimitTwoLeft){
sym.getSymbol('incorrectBar1').play('in');
sym.getSymbol('correctBar1').play('out');
sym.getSymbol('thumbsUp1').play('out');
sym.getSymbol('thumbsDown1').play('in');
axis: "x",
containment: "parent"
//for (var i = 0; i < localStorage.length; i++){ // iterate throught the local storage
//var getItem = localStorage.getItem(localStorage.key(i));
//if(getItem == 'numberOfCorrectAnswers' ){
The above is the code for the 12th project in this projects it needs to display the variable inside the object localStorage and display on the canvas.
Any help will mean a lot. Thank You in advance
P.S edge animate has a lot of bugs hard to code in
what you need to do is to create a text box and set a default value of zero. Once that is don't you need a code on the stage which grabs the value form the localStorage object. I used the .text() jquery method to display the value on the canvas. So the zero will be replaced with whatever the value of the localStorage is.
You also need a if statement to check if the localStorage is undefined, if its not then grab the value and display on the canvas.
e.g
var number = localStorage['finalValue']; // for the sake of completeness I had to put this line of code
if( number ! = undefined){ // if not undefined so the object exits then ...
sym.$(' (text identifier) '). text(number); // note text identifier is the name of the text box you create in edge
} // Done
Similar Messages
-
How to get distinct values from a list and display in a ListView webpart.
Hi,
I have a requirement in which I need to pull unique/distinct values from a custom list and then display it via a listview webpart. Can any one suggest how this can be done.
If possible please share the CAMEL query to fetch distinct values from a custom list.
Thanks,
AnkitHi Ankit,
Is there any particular reason that the values need to be shown in a list view web part? Are you going to use that web part for filtering via web part connections?
I ask because the enterprise site collection features include the SharePoint List Filter web part, which may accomplish what you're looking for.
If you just need to display the values in a grid view, you might have more luck with the JavaScript Client Object Model. Try putting the following in a text file:
<style>
.CustomTableClass{display:table;table-layout:fixed}
.CustomRowClass{display:table-row;}
</style>
<div id="distinct_values_div" class="CustomTableClass">
<img src="/_layouts/loading.gif" />
</div>
<script language="JavaScript" type="text/JavaScript">
var siteUrl = '/sitecollection/web'; //use the actual subsite URL here
var listName = 'mylist'; // use the actual list name here
var field = "Title" // use the actual field you want to display here
var divToUpdate = document.getElementById("distinct_values_div");
var rowClass = "CustomRowClass";
ExecuteOrDelayUntilScriptLoaded(function(){
var clientContext = new SP.ClientContext(siteUrl);
var web = clientContext.get_web();
var lists = web.get_lists();
var list = lists.getByTitle(listName);
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query></Query><RowLimit>500</RowLimit></View>');
this.collListItem = list.getItems(camlQuery);
clientContext.load(collListItem,"Include ("+field+")");
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed));
},"sp.js");
function onQueryFailed(sender, args){
divToUpdate.innerHTML = 'Unable to retrieve values: '+args.get_message());
function onQuerySucceeded(sender, args){
var allValues = [];
var listItemEnumerator = collListItem.getEnumerator();
divToUpdate.innerHTML = "";
while(listItemEnumerator.moveNext()){
var listItem = listItemEnumerator.get_current();
if(!containsString(allValues,listItem.get_item(field)){
var value = listItem.get_item(field);
allValues.push(value);
var newDiv = document.createElement("div");
newDiv.className = rowClass;
newDiv.innerHTML = value;
divToUpdate.appendChild(newDiv);
function containsString(strArray, text){
var contains = false;
for (var i=0; i<strArray.length; i++){
if(strArray[i]==text){contains = true; break;}
return contains;
</script>
Upload the text file to a library on the site, then add a content editor web part to a page where you want the distinct values to appear. In the content editor web part's properties, edit the Content Link so that it links directly to the text file. This
will cause the JavaScript to run on the page. -
How do I retrieve all data from a table and display it on a text area?
I want to retrieve all the data from one of my MS Access data table and display them all in a text area. how do i go among doing this?
In my car table i have the fields lined up like this..
license,color,doors and year_made
I have an Object class called CAR that will contain methods to set the data from these fields when it gets retrieved.
here's what i go so far.....
statement = getDBConnection().createStatement();
rs = statement.executeQuery("select * from car");
boolean moreRS = rs.next();
if(moreRS)
car.setLicense(rs.getLong(1));
car.setColor(rs.getString(2));
car.setDoors(rs.getString(3));
car.setYearMade(rs.getString(4));
//but this will only get me one car. How do I get more car data?
HELP!!Vector cars = new Vector();
while (rs.next()) {
String license = rs.getLong(1);
String color = rs.getLong(2);
String doors = rs.getLong(3);
String year = rs.getLong(4);
myTextArea.append(license+"\t"+color+"\t"+doors+"\t"+year+"\n");
Car car = new Car();
car.setLicense(license);
car.setColor(color);
car.setDoors(doors);
car.setYearMade(year);
cars.add(car);
}t=tab
n=newline
Vector: http://java.sun.com/j2se/1.4.1/docs/api/java/util/Vector.html -
Getting Email Value from web.xml and displaying in JSF
HI,
I have a web.xml with the entry:
<env-entry>
<description>The email address for the Support Team.</description>
<env-entry-name>support</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>[email protected]</env-entry-value>
</env-entry>I want to display on the JSF the value *"[email protected]"*. I dont want to Hard Code the Email Id on the JSF hence I am looking for this solution.
One way would be to get the value of the email in a backing bean and then setting a managedBeanValue which will be accessed in the JSF Display page.
My question is how do I get the email value in my backing bean ?
Thanks in advance !!!I tried using this code:
FacesContext context = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext)context.getExternalContext().getContext();
String value = (String)(servletContext.getAttribute("support");But when I do a System Out on value I get null
Please Help.
Thanks in advance -
How get event properties value from ocep egine and display in java .
Hi,
can please paste a code for that.Not quite understand your question. If you want to check the properties in an event type, you can use visualizer to see them easily.
And if you want to check it in java code, no matter the event is defined with java class or tuple, you can use EventTypeRepository class to get these information.
import com.bea.wlevs.ede.api.EventTypeRepository;
import com.bea.wlevs.ede.api.EventType;
import com.bea.wlevs.util.Service;
@Service
public void setEtr(EventTypeRepository etr){};
public void dumpEvent(String eventType) {
EventType type = etr.getEventType(eventType);
String[] properties = type.getPropertyNames();
} -
How to get and disply dynamic values on the fly and display in applet
hello all ,
i have a problem in refreshing a applet.
i have a scrolling applet which will get the share values from the database and display in a scrolling applet in the browser . i am getting the values and displaying it.
but the problem is , if i enter a new record in the database, until and unless i press refresh button of the browser, i am not getting the new values . please help me if anybody having the idea. please mail me to [email protected]
thank you all.
by
sambaYou want a database update to trigger an applet refresh? Can't be done.
However, you can have the applet periodically re-query the database and update its display with the information it retrieves. Just kick off a Thread that sleeps for a bit, wakes up, queries the db, updates the display, and goes back to sleep. -
I'm try to buy a movie from iTunes with my I pad 3 and it tells me there is not enough local storage and when I go to my local storage there is a lot on free storage I also restarted my ipad but still the same prob what do I do?
5GB is typically not enough space to download a movie. Often, movies take from 3 - 5 GB to begin with. The only option you have is to delete more things from your iPad. You can remove unused Apps, pictures, music, text message (messages with pictures can take up a lot of space), email messages, books, magazines etc.
-
Retrieve Title field values from multiple lists and add into another list
Hi , Iam trying to retrieve Title field value from multiple lists. and add them into another list. using Javascript. Can any one help me in doing this. Below is the code.. function save() { clientContext = new SP.ClientContext.get_current(); oWebsite = clientContext.get_web(); oList = clientContext.get_web().get_lists().getByTitle('MainList'); clientContext.load(oList); clientContext.executeQueryAsync(OnSucceeded, onQueryFailed); } function GetListItemValue(listName, fieldName) { var list = oWebsite.get_lists().getByTitle(listName); var eventValue = document.getElementById(fieldName).value; eventValue = eventValue.replace(",", ""); var camlQuery = new SP.CamlQuery(); var filterdata = '<view><query><where><eq><fieldref name="Title/"><value type="Text">' + myreqValue.trim() + '</value></fieldref></eq></where></query></view>'; camlQuery.set_viewXml(filterdata); listItems = list.getItems(camlQuery); clientContext.load(list); clientContext.load(listItems, 'Include(Id)'); clientContext.executeQueryAsync(Succeeded,Failed); } function OnSucceeded() { itemCreateInfo = new SP.ListItemCreationInformation(); oListItem = oList.addItem(itemCreateInfo); oListItem.set_item('Title', 'My New Title'); var deptItemLookupField = new SP.FieldLookupValue(); //Problem in below line...I was unable to get ID var getId = GetListItemValue("Listname1", "txtboxname1"); alert("ID" + getId); if (getId != undefined) { deptItemLookupField.set_lookupId(getId); } var getId12 = GetListItemValue("Listname12", "txtboxname12"); alert("ID" + getId12); if (getId12 != undefined) { deptItemLookupField.set_lookupId(getId12); } oListItem.update(); clientContext.executeQueryAsync(itemadded, itemFailed); } function itemadded() { alert('Item added successfully'); } function itemFailed(sender, args) { alert('Item added itemFailed' + args.get_message() + '\n' + args.get_stackTrace()); }
RajHi,
For this requirement, you will need to retrieve all the lists objects you want firstly, then execute the requests one by one to get the value of the Title column using CAML or
LINQ.
How to: Retrieve Lists Using JavaScript
http://msdn.microsoft.com/en-us/library/office/hh185009(v=office.14).aspx
About
retrieve list items:
http://msdn.microsoft.com/en-us/library/office/hh185007(v=office.14).aspx
You can use
Promise in your script to make your requests sequentially:
http://www.shillier.com/archive/2013/03/04/using-promises-with-the-javascript-client-object-model-in-sharepoint-2013.aspx
http://www.learningsharepoint.com/2013/08/13/using-deferred-and-promise-to-handle-async-calls-in-sharepoint-client-object-model/
Best regards
Patrick Liang
TechNet Community Support -
How can I use wget, cron and Automator to periodically pull an image from a URL (which is dynamically updated - like a weather map, say - to local storage, and then update a Keynote slide with that image, automatically?
Any particular reason for those specific technologies? wget does not exist on a mac, although you can nstall it I guess. OS X has curl installed which should do pretty much anything you want to do with wget. cron is being replaced by launchd, although cron still exists on mountain lion.
As far as I can tell from automator all the standard 'actions' to access keynote available to it require keynote to be open and running, but does not provide a function to actually open it. So I think you will have to write some applescript, as a minimum to open and quit keynote. I notice that the keynote actions are mostly circa 2005 an wonder if they would even work.
Under utilities in automator 'actions' there is a capability to add applescripts as part of the workflow.
Also, note that cron is being dprecated by Apple and replaced by launchd. that said cron is stil on my mountain lion instalation.
This entry at stackoverflow shows use of cron with curl to get web urls. http://stackoverflow.com/questions/1683620/getting-started-with-cronjobs-on-a-ma c
If I have any time I may try and get this to work as it is quite interesting and new to me. But otherwise, good luck. -
Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Todd,
Let me try to explain you this time. I have a text field in a TiledViewBean.
When I display the page, the text field
html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say
five times/rows with same name.
The html tags look like this.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
When the form is submitted, I want to get the text field values using the
method getTbFieldName().getValues() which
returns an array object[]. This is in case where my TiledViewBean is not
bound and it is working fine.
Now in case when my TiledView is bound to a model, it creates the html tags
as follows.
<input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[1].tbFieldName" value=""
maxlength=9 size=13>
<input type=text name="PageDetail.rDetail[2].tbFieldName" value=""
maxlength=9 size=13>
Now when I say getTbFieldName().getValues() it returns only the first
element values in the object[] and the rest of the
values are null.
May be we need to create a utility method do get these values from
requestContext.
raju.
----- Original Message -----
From: Todd Fast <toddwork@c...>
Sent: Saturday, July 07, 2001 3:52 AM
Subject: Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
Raju.--
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing likeI'm afraid I don't understand your point--can you please clarify? Do you
mean "value" instead of "name"?
What are you trying to do? What behavior are you expecting but notseeing?
>
Without further clarification, I can say that the setValues() methodsNEVER
populates data on multiple rows of a (dataset) model, nor does it affect
multiple fields on the same row. Perhaps what you are seeing is theeffect
of default values. Model that derive from DefaulModel have the ability to
carry forward the values set on the first row to other rows in lieu ofdata
in those other rows. This behavior is for pure convenience and can be
turned off, and it is turned off for the SQL-based models.
Todd
[email protected]Hi,
I wanted to know how the getValues() method works the reason being,
when the tiled view is NOT bound to a model, it populates all the
fields with the same name as some thing like
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[0].tbFieldValue
in which case, the getValues() method works fine.
But in case where the tiled view is bound to a model, it populates
with different field names such as,
PageDetail.rDetail[0].tbFieldValue
PageDetail.rDetail[1].tbFieldValue
in this case, the getValues() doesn't work. Any soultion to this?
We are using Moko 1.1.1.
thanks in advance,
raju.
--- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
Does anyone know of is there a single method to get all values of a
display
field in a tiled view without having to iterate through all the
values ie
resetTileIndex() / nextTile() approach.
ie Something that returns an Object[] or Vector just like ND returned a
CspVector. I tried using the getValues() methods but that allways returns
a
single element array containing the first element.
(I think now, that method is used for multi selecteable ListBoxes)Actually, no. We can add this in the next patch, but for now, I'd recommend
creating a simple utility method to do the iteration on an arbitrary model
and build the list for you.
Todd -
How to retrieve 2 values from a table in a LOV
Hi
I'm pretty new to APEX. I try to retrieve two values from a table using a LOV. I have a table named DEBIT with then columns SITE, NAME and KEY
I want to display NAME to the user in a list. When the user select an item from the list, I want to retrieve the data of the SITE and KEY column of this item in order to launch an SQL command based on this two values.
How to retrieve thes two values whant the user chooses an item from the list ?
I apologize for my english, being french.
Regards.
ChristianChristian,
From what I understood about your requirement, you want a 'select list with submit' which displays "NAME" and based on the value selected, you want to get the corresponding values for "SITE" and "KEY" from the table.
<b>Step 1: Create a select list with submit, say P1_MYSELECT </b><br><br>
Use something like this in the dynamic list of values for the select list: <br>
SELECT NAME display_value, NAME return_value
FROM DEBIT<br><br>
<b>Step 2: Create a page process of type PL/SQL block. Also create 2 hidden items P1_KEY and P1_SITE. </b><br><br>
In the PL/sQL, write something like:
DECLARE
v_key DEBIT.KEY%TYPE;
v_site DEBIT.SITE%TYPE;
CURSOR v_cur_myvals IS
SELECT KEY, SITE
FROM DEBIT
WHERE NAME = :P1_MYSELECT;
BEGIN
OPEN v_cur_myvals;
LOOP
FETCH v_cur_myvals
INTO v_key,v_site;
EXIT WHEN v_cur_myvals%NOTFOUND;
:P1_KEY := v_key;
:P1_SITE := v_site;
END LOOP;
CLOSE v_cur_myvals;
END; <br><br>
Then you can use these values for whatever purpose you need to.
Hope this helps. -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
How to derive a variable value from another variable of a different IO?
Hi Gurus,
I am aware that using BEx variables and Customer Exit you are able to derive a variable value from another variable of the same infoobject (for example, Fiscal Year/Period (0FISCPER) and Calendar Day (0CALDAY)).
However, is is possible, using the same approach to derive a variable value from another variable that is in a different InfoObject? (for example, Input Fiscal Year/Period (0FISCPER) but derive Output of Required Start Date (0REQSTDAT))?
There are 2 BEx variables involved,
1) A user entry variable that is restricted in 0FISCPER
2) A customer exit variable that is restricted in ZREQSTDAT
In CMOD under EXIT_SAPLRRS0_001, Include ZXRSRU01, the code (I assume, correct me if I'm wrong) should perform 3 functions in I_STEP = 2,
1) After the pop up, capture user entry of Fiscal Year/Period
2) Identify or convert Fiscal Year/Period to Calendar Day range (unsure on how to code this portion)
3) Use the Calendar Day to lookup on matching Required Start Date and display all Required Start Date that matches. (unsure on how to code on this portion)
Hope to hear your thoughts soon.
Regards,
EricHi Shanthi,
I've made the necessary adjustments. The only difference in my code is,
Instead of,
If I_VNAM = 'ZREQSTDAT'
I use,
CASE I_VNAM.
Instead of,
PARAMETERS: ZFISCPER TYPE /BI0/OIFISCPER.
ZYEAR = ZFISCPER(4).
ZMM = ZFISCPER+4(3).
I use ,
This is the Customer Exit Variable in ZREQSTDAT
WHEN 'ZRSD_CX'.
The loop I use for the User Entry Variable in 0FISCPER-ZFYP_IN
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZFYP_IN'.
IF SY-SUBRC = 0.
CLEAR L_S_RANGE.
ZYEAR = LOC_VAR_RANGE(4).
ZMM = LOC_VAR_RANGE+4(3).
The codes were checked with no errors.
However, when I input the Fiscal Year/Periods and hit 'Execute'. The report went blank, not sure what is the cause. I've tried it several times. No error message appeared.
Regards,
Eric -
Has anyone retrieved a value from a system Matrix from selecting the row
Hi everyone, I am trying to retrieve the value of a cell from the first column of a matrix depending on which row the user has highlighted. I can access the value from specifying which row to retrieve the value from but not from the user selecting which row. Im attempting do do this from the open items list system form which is accessed from the reports menu.
To retrieve the value from the first row my code is as follows:
oMatrix = oForm.Items.Item("5").Specific
DocNo = oMatrix.Columns.Item("1").Cells.Item(1).Specific.Value
SBO_Application.MessageBox(DocNo)
How do I change this code to access the value of the cell depending on which row is highlighted?
Any help would be appreciatedHi Sally,
you will get the selected row number on any event through "pVal.Row", you can get this value in a integer variable like:
int i = pVal.Row
and pass it in your code;
DocNo = oMatrix.Columns.Item("1").Cells.item(i)
or you can do same in this way also:
you have to specify your particular cell as a edit text and get the value of that:
oEditText=(SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific;
string1 = oEditText.String;
Hope it will help. -
Retrieving all values from hashmap in order you put them in
Hi guys,
I want to retrieve all values from a HashMap in the order I put them in.
So I can't use the values() method that gives back a collection and iterate over that.
Do you guys know a good way to do that ?You can just do something like this:
class OrderedMap
private final Map m_rep = new HashMap();
private final List m_keys = new ArrayList();
public Object get( final Object key )
return m_rep.get( key );
public Object put( final Object key, final Object value )
final Object result = m_rep.put( key, value );
if ( result != null )
m_keys.add( key );
return result;
public Object remove( final Object key )
final Object result = m_rep.remove( key );
if ( result != null )
m_keys.add( key );
return result;
public Iterator keyIterator()
return m_rep.iterator();
}Then use it like this:
for ( Iterator it = map.keyIterator(); it.hasNext(); )
final Object value = map.get( it.next() );
}This will be in the order you put them in. However, if you want to do this correctly, you should implement the Map interface and add all the methods. Another thing you can do is download the JDK 1.4 source, learn how they did and do it the same way for 1.2.
R.
Maybe you are looking for
-
Hello any body who can help me out here? My sound system is not working on my imac after the last updates, WHAT SHALL I DO FOR????
-
Syncing dual boot data: SL and Mavericks?
Hello Happy New Year to Us All! I am wondering what to do to best keep user data between SL and Mavericks synced? I have an old Macbook Pro with Snow Leopard and I want to dual boot SL and Mavericks. My computer is an 8 gb RAM mid '09 15" Macbookk P
-
I email popup isn't working nor can I open pages on a new tab using right-click
I have AOL mail and I view my emails in a pop-up and now I click on the email and nothing happens- I cannot read them. When I am searching for videos or looking at content that is contained in a list I like to open links in a new tab so that I don't
-
Have IPOD and partners Itunes - how to use it for me?
I am not good with technology and easily confused! I have an old IPOD that is full with about 2000 of my songs. We have moved overseas and I use my partners computer. He has Itunes installed with all his IPOD details on it. My question is - how do I
-
When i plug my iPhone in rosette ( with euro adapter) the iPhone display has bug
May anybody can help me?