Updating a view after modifying a table...
Hello,
Here is the scenario.
I have a a table in HANA with 50+ columns of data. I have created both Attribute and Analytical views of that data. These views have been activated and deployed. Now I need to modify my table to add two new columns that I will want to included in my existing Attribute and Analytical views. How can I accomplish this? It seems that when I modify my table, the views in HANA studio do not have the ability to be updated. It seems I have to re-create my voews from scratch to now include my two new columns. Hopefully I am missing something simple.
Thanks in advance!
Hi Matt, no way you need to recreate your views after a DDL change on the underlying tables.
When the table structure changes, you usually need to close any information view editors on the model in question and then reopen the model for editing after the change, but otherwise should be fine. I have done this many times.
What revision are you working on? Can you give the exact sequence of steps?
Regards,
Justin
Similar Messages
-
Status of VIEW after partitioning base table.
Hi All,
I would like to know the status of the view when i perform Range partitioning on Base table???
I will be performing these below steps for partitioning:
1. Rename the Original base table.
2. Create new partitioned table by naming it as original table name.
3. Insert rows from Original table to partitioned table.
As from above steps i am renaming the original base table and creating Partitioned base table with the same original name.
Do VIEWS based on this table will refer to new partitioned table having same name, or do i need to re-create views???
-YasserView refers to NEW Partition TABLE on the same name... it's not the problem.. if you didn't rename delete add column_name.
SQL> create table a1 (id number);
Table created.
SQL> create view v_a1 as select * from a1;
View created.
SQL> desc v_a1;
Name Null? Type
ID NUMBER
SQL> alter table a1 rename to a2;
Table altered.
SQL> desc v_a1;
ERROR:
ORA-24372: invalid object for describe
SQL> create table a1 (id varchar2(40))
2 /
Table created.
SQL> desc v_a1;
Name Null? Type
ID VARCHAR2(40) -
Grant privilege disappeared after modify versioned table
After adding two columns to a version table using wm package, the previous grant privilege on the version table disappeared. Is it expected behavior or a bug?
AshleyAshley
This is a bug. We have since fixed it and it will be available in the next release. For now, the workaround is that you have to grant the privilege again. Sorry for the inconvenience.
Arun -
How to update view without modifying the base table ?
Hi Experts , I need help in two qurstions
1. How to update a view without modifying the base table ?
2. How to write a file unix operating system in pl/sql ? is there any built in procedure is there ?
Thank youHi,
I'm not sure what you're asking in either question. It would help if you gave a specific example of what you want to do.
SowmyRaj wrote:
Hi Experts , I need help in two qurstions
1. How to update a view without modifying the base table ?You can't.
Views don't contain any data; they just query base tables.
You can change the definition of a view (CREATE OR REPLACE VIEW ...) so that it appears that the base table(s) have changed; that won't change the base tables.
2. How to write a file unix operating system in pl/sql ? is there any built in procedure is there ?The package utl_file has routines for working with files. -
Hi, experts
I read these from internet:
Oracle provides a rename table syntax as follows:
alter table
table_name
rename to
new_table_name;
For example, we could rename the customer table to old_customer with this syntax:
alter table
customer
rename to
old_customer;
When you rename an Oracle table you must be aware that Oracle does not update applications (HTML-DB, PL/SQL that referenced the old table name) and PL/SQL procedures may become invalid.
How can I update the applications after rename the table?
Thank you in advancedSo, far i think rename can be done by --
satyaki>
satyaki>create table test_aa
2 as
3 select * from emp;
Table created.
satyaki>
satyaki>
satyaki>rename test_aa to test_new_aa;
Table renamed.
satyaki>
satyaki>
satyaki>select * from test_new_aa;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
1230 TEST 10
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
15 rows selected.Regards.
Satyaki De. -
How to update specific fields of a db table using MODIFY
Hi all.
I understand that MODIFY allows us to insert a record into the database if the a record with the same key is not there. If a record is there, it would update that record.
However, when the record is there, could i update SPECIFIC fields of the record, instead of updating ALL fields of the record?Yes, you can with exception that you can not modify primary key values.
Here are the details about MODIFY db table command with examples
MODIFY - Change a database table
Variants:
MODIFY dbtab. or MODIFY *dbtab. or
MODIFY (dbtabname) ... .
MODIFY dbtab FROM TABLE itab. or MODIFY (dbtabname) FROM TABLE itab.
MODIFY dbtab VERSION vers. or MODIFY *dbtab VERSION vers.
Effect
Inserts new lines or updates existing lines in a database table (s. relational database). If a line with the specified primary key already exists, an UPDATE is executed. Otherwise, an INSERT is performed. You can specify the name of the database table either in the program itself in the form MODIFY dbtab ... or at runtime as the contents of the field dbtabname in the form MODIFY (dbtabname) ... . In both cases, the database table must be defined in the ABAP Dictionary. If the program contains the name of the database table, it must also have a corresponding TABLES statement. Normally, records are inserted or updated only in the current client. Data can only be inserted or updated using a view, if the view refers to a single table and was created in the ABAP Dictionary with the maintenance status "No restriction".
MODIFY belongs to the Open SQL command set.
When the statement has been executed, the system field SY-DBCNT contains the number of edited lines.
The Return code is set as follows:
SY-SUBRC = 0:
All lines were successfully inserted or updated.
SY-SUBRC = 4:
One or more lines could not be inserted or updated.
Notes
1. You cannot modify a line if there is already a line in the table with identical key field values in a UNIQUE index.
2. Automatic definition of INSERT and UPDATE is expensive. You should therefore use MODIFY only if you cannot define the INSERT and UPDATE cases yourself in the program.
3. Since the MODIFY statement does not perform authority checks, you have to program them yourself.
4. Adding or changing lines with the MODIFY command is only completed after a database commit (see LUW) has been performed. Before the database commit has been performed, any database changes can be reversed with a database rollback (see Programming transactions).
5. Synchronization of simultanous accesses by several users to the same set of data cannot be exclusively achieved with the lock mechanism of the database system. In several cases, you are recommended to use the SAP lock mechanism.
Variant 1
MODIFY dbtab. or
MODIFY *dbtab. or
MODIFY (dbtabname) ... .
Extras:
... FROM wa
... CLIENT SPECIFIED
See Cannot Use Short Forms and
Cannot Use *Work Areas.
Effect
Inserts a new line or updates an existing line in a database table. If you specify the name of the database table yourself, the primary key for identifying the line to be inserted or updated and the relevant values are taken from the table work area dbtab or *dbtab (see TABLES). If you declare the name of the database table explicitly, the program must also contain a corresponding TABLES statement. If the name of the database table is not determined until runtime, you need to use the addition ... FROM wa.
Example
Insert or change data of the customer Robinson in the current client:
TABLES SCUSTOM.
SCUSTOM-ID = '12400177'.
SCUSTOM-NAME = 'Robinson'.
SCUSTOM-POSTCODE = '69542'.
SCUSTOM-CITY = 'Heidelberg'.
SCUSTOM-CUSTTYPE = 'P'.
SCUSTOM-DISCOUNT = '003'.
SCUSTOM-TELEPHONE = '06201/44889'.
MODIFY SCUSTOM.
Addition 1
... FROM wa
Effect
The values for the line to be inserted or updated are not taken from the table work area dbtab, but from the explicitly specified work area wa. When doing this, the data is read from left to right according to the structure of the table work area dbtab (see TABLES). Since the structure of wa is not taken into account, the work area wa must be at least as wide (see DATA) as the table work area dbtab and the alignment of the work area wa must correspond to the alignment of the table work area. Otherwise, a runtime error occurs.
Note
If a work area is not explicitly specified, the values for the line to be inserted or updated are also taken from the table work area dbtab if the statement is in a FORM or FUNCTION where the table work area is stored in a formal parameter or local variable of the same name.
Addition 2
... CLIENT SPECIFIED
Effect
Switches off automatic client handling. This allows you to edit data across all clients even when dealing with client-specific tables. The client field is treated like a normal table field that can be programmed to accept values in the table work area dbtab or *dbtab where the line to be edited occurs.
The addition CLIENT SPECIFIED must be specified immediately after the name of the database table.
Variant 2
MODIFY dbtab FROM TABLE itab.or
MODIFY (dbtabname) FROM TABLE itab.
Addition:
... CLIENT SPECIFIED
Effect
Mass modify: Inserts new lines or updates existing lines of a database table. The primary keys for identifying the lines to be inserted or updated and the relevant values are taken from the internal table itab. The lines of the internal table itab must satisfy the same conditions as the work area wa in addition 1 to variant 1.
Note
If the internal table itab is empty, SY-SUBRC and SY-DBCNT are set to 0.
Addition
... CLIENT SPECIFIED
Effect
As for variant 1.
Variant 3
MODIFY dbtab VERSION vers. or
MODIFY *dbtab VERSION vers.
See Cannot Use the VERSION Addition.
Note
This variant is obsolete.
Effect
Inserts a new line or updates an existing line in a database table, the name of which is taken from the field vers at runtime. If no line exists with the specified primary key, an INSERT is executed. Otherwise, an UPDATE is performed. The database table must be defined in the ABAP/4 Dictionary and its name must conform to the naming conventions for R/2 ATAB tables. These stipulate that the name must begin with 'T' and may contain up to four further characters. The field vers must contain the table name without the leading 'T'. Only lines in the current client are inserted or updated. The line to be inserted is taken from the statically specified table work area dbtab or *dbtab.
SY-SUBRC is set to 0 if the line is successfully inserted or updated. SY-SUBRC <> 0 is not possible since any other result causes a runtime error.
Hope this helps.
ashish -
Can I update datas of Power Query after making relation tables in Power Pivot ?
Can I update datas of Power Query after making relation tables in Power Pivot ?
I want to update datas at day by day to viewing today's graph by Power View on Excel.
Power Query use to transform web site to Power Pivot data model table.
Power Pivot use to making relasing tables, and making measuers.
Regards,
Yoshihiro Kawabata.Hi Yoshihiro,
Can you share an example of the things you are doing in Power Pivot? There are some operations that prevent the query from being refreshed in Power Query; this is not ideal so we are currently working on fixing it.
Thanks for your feedback. -
Want to update data in a view based on multiple tables
Hi
I am facing a problem i want to update data in tables using a view. As that view is based on multiple tables so i am unable to update data. i came to know we can update table from view only if view is based on single table. so if anyone knows any alternative please let me know.
Thanx
DevinderDevinder,
The table can be updated through a view based on multiple tables, if and only if the table is a "key preserved" table. Rather than explaining myself, i avoided the burden of typing by finding the material in Oracle Docs and pasting it for you :-)
If you want a join view to be updatable, all of the following conditions must be
true:
1. The DML statement must affect only one table underlying the join.
2. For an INSERT statement, the view must not be created WITH CHECK
OPTION, and all columns into which values are inserted must come from a
key-preserved table. A key-preserved table in one for which every primary
key or unique key value in the base table is also unique in the join view.
3. For an UPDATE statement, all columns updated must be extracted from a
key-preserved table. If the view was created WITH CHECK OPTION, join
columns and columns taken from tables that are referenced more than once
in the view must be shielded from UPDATE.
4. For a DELETE statement, the join can have one and only one key-preserved
table. That table can appear more than once in the join, unless the view was
created WITH CHECK OPTION.
HTH
Naveen -
Updatable Materialized View and Master Table on same database
Hi all,
My first question - Is it possible to have an Updatable Materialized View and the associated Master Table located on the same database?
This is the requirement scenario:
One unique database D exists.
A is a batch table. Only inserts are allowed on Table A.
M is an updatable materialized view on Table A (Master). Only updates are allowed on M (no insert or delete).
Requirement is to push updates/changes from M to A periodically and then get the new inserted records from A into M via a refresh.
Is this possible? What other approaches are applicable here?John,
My question is related to the implementation and setup of the environment as explained in the above example. How can I achieve this considering that I have created an updatable m-view?
If possible, how do I push changes made to an updatable m-view back to it's master table when/before I execute DBMS_MVIEW.REFRESH on the m-view? What is the procedure to do this if both table and mview exist on the same database? Do I need to create master groups, materialized view refresh groups, etc.?
One more thing.. Is there a way to retain changes to the m-view during refresh? In this case, only newly inserted/updated records in the associated table would get inserted into m-view. Whereas changes made to m-view records would stay as-is.
Hope my question is directed well. Thanks for your help.
- Ankit -
Hi and thanks in advance !
i am facing a critical situation.
i have two schema & both are same!
the problem which i am facing is during updating a view of one i am facing above error while the same DML is issuing againt that view in other schema and that works fine.
what's the reason..
The major difference between two schema's is i hav different live and test database i migrate my access database to Oracle test database # 1.here i created a new user name deals . ok
i hav done same migration in my another database but a little difference here user deals is already available here and tables and views are also available i drop all the object but forget to purge recyclebin. now whenever i try to issue DML at this schema i am facing above error while the same tables same data and same view is available in above databae where my update statement executed properly. one more thing i like to add here i hav some unwanted trigger 'BIN$##$$%##$# bla bla bla' on different table. i haven't created that .
here is the view for your kind perusal
CREATE OR REPLACE VIEW QRYREUTER AS
SELECT FXdeals.deal_no,
cparty.name,
cparty.city,
FXdeals.brokbill,
FXdeals.deal_date,
FXdeals.mode_id
FROM FXDeals
JOIN cparty
ON FXdeals.cpcode = cparty.cpcode
WHERE ( ( (FXdeals.mode_id) = 3 ) )
Message was edited by:
Fiz Dosanibut i have sample scenario in other schema which replica of this schema so why i haven't got this error there
one more interesting thing when i query select * from user_updateable_columns where table name ='ABC' in Schema # 1 it return i can modify some columns.
but when issue the data dictionary view in schema # 2, where i was facing ORA-1779 , select * from user_updateable_columns where table name ='ABC' in Schema # 2 it return i can not modify any columns.
Tables name are same in both schema.
Data same in both schema.
Constraint Same in both schema.
Indexes same in both schema.
why facing error in one schema not in other.
one more interesting thing, i had faced questionable object error when importing DMP into schema # 2. -
ORA-01776: I can't insert on a view comprised by two tables
Good morning:
I'm trying to do an insertion on a view comprised by the join of two tables (departments and employees) and it failed.
The view is this one:
CREATE OR REPLACE FORCE VIEW "EMPDPTO" ("EMPLOYEE_ID", "LAST_NAME", "EMAIL", "HIRE_DATE", "JOB_ID", "DEPARTMENT_ID", "DEPARTMENT_NAME") AS
SELECT employee_id, last_name, email, hire_date, job_id, d.department_id, department_name
FROM employees e, departments d
WHERE e.department_id = d.department_id
My insertion command
INSERT INTO empdpto
VALUES(743, 'Bermejo', '[email protected]', '12/12/09', 'IT_PROG', 10, 'Administration');
throws a ORA-01776: it's not possible to modify more than one base table through a join union.
On the other side I've seen in documentation that in certain circunstances is possible to do an insertion on a complex view.
Is it possible to do an insertion on a view comprised by two tables?. Under what circunstances?.
ThanksFrom SQL Reference CREATE VIEW section Notes on Updatable Views http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#i2065510
>
If you want a join view to be updatable, then all of the following conditions must be true:
The DML statement must affect only one table underlying the join.
For an INSERT statement, the view must not be created WITH CHECK OPTION, and all columns into which values are inserted must come from a key-preserved table. A key-preserved table is one for which every primary key or unique key value in the base table is also unique in the join view.
For an UPDATE statement, the view must not be created WITH CHECK OPTION, and all columns updated must be extracted from a key-preserved table.
>
The first condition is not true for the view you have created.
Edited by: P. Forstmann on 26 janv. 2010 20:17 -
Trigger in mutation - Update another rows in the same table with a trigger
Hi ,
I try to do a before update trigger on a table , but the trigger is in mutation. I understand why it do that but my question is :
How can I update other rows in the same table when a UPDATE is made on my table??????
Here is my trigger :
CREATE OR REPLACE TRIGGER GDE_COMPS_BRU_5 BEFORE
UPDATE OF DEPARTEMENT--, DISCIPLINE, DEG_DEMANDE, CE_ETAB
ON GDEM.COMPOSITION_SUBV
FOR EACH ROW
Organisme : FQRNT-FQRSC
Date de création : 14-07-2011
Date de modification :
Modifié par :
Auteur : Johanne Plamondon
Description : Ce déclencheur s'executera lors de la modification
du responsable dans la table COMPOSITION_SUBV
DECLARE
V_OSUSER V$SESSION.OSUSER%TYPE;
V_PROGRAM V$SESSION.PROGRAM%TYPE;
V_TERMINAL V$SESSION.TERMINAL%TYPE;
V_MACHINE V$SESSION.MACHINE%TYPE;
V_MODULE V$SESSION.MODULE%TYPE;
V_LOGON_TIME V$SESSION.LOGON_TIME%TYPE;
V_AUDIT_ID NUMBER;
vSEQ NUMBER;
i NUMBER;
vID DEMANDE.ID%TYPE;
BEGIN
begin
SELECT OSUSER, PROGRAM, TERMINAL,MACHINE,MODULE, LOGON_TIME
INTO V_OSUSER,V_PROGRAM,V_TERMINAL,V_MACHINE,
V_MODULE,V_LOGON_TIME
FROM V$SESSION
WHERE TYPE = 'USER'
AND USERNAME = USER
AND LAST_CALL_ET IN (0,1)
AND ROWNUM < 2;
exception when others then null; end;
IF NVL(:NEW.SC_PART,' ') = 'CHC' THEN
SELECT COUNT(*)
INTO i
FROM DEMANDE
WHERE DEM_REF = :NEW.DEM_ID
AND PER_NIP = :NEW.PER_NIP;
IF i = 1 THEN
SELECT ID
INTO vID
FROM DEMANDE
WHERE DEM_REF = :NEW.DEM_ID
AND PER_NIP = :NEW.PER_NIP;
UPDATE COMPOSITION_SUBV
SET --CE_ETAB = :NEW.CE_ETAB,
--DISCIPLINE = :NEW.DISCIPLINE,
DEPARTEMENT = :NEW.DEPARTEMENT,
--DEG_DEMANDE = :NEW.DEG_DEMANDE,
DATE_MODIF = SYSDATE,
USER_MODIF = V_OSUSER
WHERE DEM_ID = vID
AND PER_NIP = :NEW.PER_NIP
AND ANNEE = :NEW.ANNEE;
END IF;
END IF;
/*EXCEPTION
WHEN OTHERS THEN
NULL;*/
END;A standard disclaimer, the mutating trigger error is telling you that you really, really, really don't want to be doing this. It generally indicates a major data model problem when you find yourself in a situation where the data in one row of a table depends on the data in another row of that same table. In the vast majority of cases, you're far better off fixing the data model than in working around the problem.
If you are absolutely sure that you cannot fix the data model and must work around the problem, you'll need
- A package with a collection (or global temporary table) to store the keys that are modified
- A before statement trigger that initializes the collection
- A row-level trigger that adds the keys that were updated to the collection
- An after statement trigger that iterates over the data in the collection and updates whatever rows need to be updated.
If you're on 11g, this can be simplified somewhat by using a compound trigger with separate before statement, row-level, and after statement sections.
Obviously, though, this is a substantial increase in complexity over the single trigger you have here. That's one of the reasons that it's generally a bad idea to work around mutating table exceptions.
Justin -
Error value after modifying the contract
Hi Guys,
I need help in getting the correct values of u2018Released valueu2019 field of Contract.
I have written code in u2018ZV_USEREXIT_SAVE_DOCUMENTu2019. The following code is updating incorrectly on the screen for all line items with the last value of xvbap-awert, when I am saving the contract after modifying it like changing PO date :-
loop at xvbfa where posnv ne 0 and rfwrt ne 0.
move xvbfa-rfwrt to xvbap-awert.
update vbap set netwr = xvbap-awert " RV45A-AWERT
where vbeln = xvbap-vbeln
and posnr = xvbap-posnr.
commit work.
Endloop.
If the above code is commented, all line items u2018Released valueu2019 field is initialized.
The values of xvbap-awert for all line items are modifying correctly in internal table xvbap. But in the initial screen of Contract field (VA42) u2018Release valueu2019 is displaying last value of xvbap-awert. This screen field is a structure field RV45A-awert.
Please help at earliest.Hi,
Did you follow the article below:
Optional Configurations
https://technet.microsoft.com/en-us/library/ee758052%28v=exchg.140%29.aspx
After disable the Automatic Alert Resolution Feature in the Correlation Engine, have you restart the Microsoft Exchange Monitoring Correlation Engine service?
I assume you missed something when you edit the config file.
You may change it back and then check the result.
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Modify database table from internal table
Hi All,
I need to update database table from internal table which is having around 30000 records.
I am using MODIFY tabname FROM TABLE int_tabname...
Using this statement, I can modify the databse records very well. But user has some additional requirement.
He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
Any help will be appriciated,
Regards,
NehaHi
modifying datbase table useing internal table
<b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
write the logic for modifying
Modify the database table as per new dunning procedure
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
and finally unlock the table
<b>example</b>
*To lock table for further operations
constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = lc_tabname
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc EQ 0.
To fetch all the contract accounts for customers of the segment
Households/SME.
PERFORM fetch_contract_accounts using lc_tabname .
ENDIF. " IF sy-subrc EQ 0.
*wrote the logic
Modify the database table as per new dunning procedure from internal table
MODIFY fkkvkp FROM TABLE lt_fkkvkp .
*unlock the tbale
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
TABNAME = uc_tabname .
<b>Reward if usefull</b> -
Update data immediately when modify !
Hello everyone, I have problem with my list data. My data isn't updated when modified. I have two page :
1. BookPage contains a list of song
- XAML code :
<ListView Grid.Column="1"
Name="ListViewSong"
IsItemClickEnabled="True"
ItemClick="SongDetail_Click"
Margin="10,0,0,10"
ContinuumNavigationTransitionInfo.ExitElementContainer="True">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Holding="ListViewItem_Holding" Width="340"
Margin="0,0,0,15">
<FlyoutBase.AttachedFlyout>
<MenuFlyout>
<MenuFlyoutItem Tag="{Binding}" Click="AddToFavorite_Click"
Text="Thêm vào yêu thích..." />
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
<TextBlock TextAlignment="Center"
Text="{Binding ID,Mode=TwoWay}"
FontSize="22"
Foreground="DodgerBlue" />
<TextBlock Foreground="GreenYellow"
TextWrapping="WrapWholeWords"
TextAlignment="Center"
Text="{Binding FullName,Mode=TwoWay}"
FontSize="18" />
<TextBlock
TextAlignment="Left"
FontSize="12"
Text="{Binding Lyric,Mode=TwoWay}"
Visibility="{Binding Lyric,Converter={StaticResource ConvertTextToVisibility}}"
FontStyle="Italic"
TextTrimming="WordEllipsis" />
<TextBlock
Foreground="Silver"
TextAlignment="Right"
FontSize="14"
Text="{Binding Author,Mode=TwoWay}" Margin="0,0,10,0" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
- Class Song code :
public class Song {
public string ID { get; set; }
public string FullName { get; set; }
public string Lyric { get; set; }
public string Author { get; set; }
public string ShortName { get; set; }
public string NoMarkName { get; set; }
- Load data and Bind to ListView:
public static ObservableCollection<Song> ListAllSongs = new ObservableCollection<Song>();
private async void BookPage_Loaded(object sender, RoutedEventArgs e)
// hiện panel progressbar loading
ProgressBarLoading.Visibility = Visibility.Visible;
ProgressBar.IsIndeterminate = true;
await Task.Delay(1000);
App.ListAllSongs = await App.ViewModel.LoadArirang();
// binding data to Pivo Item "Tat ca"
ListViewSong.ItemsSource = App.ListAllSongs;
// binding data to Pivo Item "Yeu Thich"
ListFavoriteSong.ItemsSource = App.FavoriteSong;
// ẩn panel loading
ProgressBarLoading.Visibility = Visibility.Collapsed;
ProgressBar.IsIndeterminate = false;
// cho phep filter
LeftPanelFilter.IsItemClickEnabled = true;
-- Click any song on the List and navigate to SongDetail Page for modifying. After modify , then save and go back to
BookPage but data not change on the UI.
protected override void OnNavigatedTo(NavigationEventArgs e)
_song = e.Parameter as Song;
this.DataContext = _song;
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
var updateSOng = App.ListAllSongs.SingleOrDefault(s => s.ID.Equals(_song.ID));
updateSOng.FullName = txtNewNameTextBlock.Text;
Frame.GoBack();
How could I do that ?
OmegaVN - Window Phone Application Researching and Developmentthe song class should implement the INotifyPropertyChanged interface so the UI knows the data has been changed and to update itself.
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged%28v=vs.110%29.aspx
I use ObservableCollection - it implement interface INotifyPropertyChanged internal ... .I read this from the Windows Phone 8.1 Development for Absolute Beginners on Channel9.
"Having said all of that, the Hub App Template does not have any classes the directly
implement INotifyPropertyChanged. Instead, it uses ObservableCollection<T> (as well as a
custom class, ObservableDictionary) which implements the INotifyPropertyChanged interface
internally. So, the moral to the story is that, as long as we’re using ObservableCollection<T> to
expose collections of the objects from the ViewModel to the View" -
Windows Phone 8.1 Development for Absolute Beginners – Page 199
OmegaVN - Window Phone Application Researching and Development
Maybe you are looking for
-
Using one iPad with multiple iTunes accounts
I am trying to understand the iTunes implementation on iPad..After synching my MBP on an iPad, all of my settings music, photos,mail are transferred to the iPad...my wife now wants to use the iPad as we are traveling...can my iPad's iTunes be signed
-
Need to determine if an Expression field is empty in CR 2011
I have an expression field in a subreport. This field collects a list of computer models to which a given hard drive is assigned. I need the field to always have a border around it even if there is no data. But I have been told by someone on this for
-
How to change the retention period of os watcher log,
How to change the retention period of os watcher log, by default it is 7 days. but in our exadata env. automatically oswatcher logs are deleted , so i want to check the retention period. Regards, Ani
-
Multiple sounds, One sound object.
So, What I want to do is load in a narrative, based on what a person is doing in a game. I create a sound object, load in a sound and play it. But, once the user does something, i want to stop that sound and start up another sound. I don't want to us
-
I just burned a DVD from a 4 minute movie that I made. The movie was just pictures with music behind it. The video was fine but the audio is all scratchy (this has happened on the last couple that I burned). The song was a purchased song from iTunes.