Help To create a Dynamic Update Statement in RIA 3.2d for memory tbl


Madhav saran
 

Can I construct a Dynamic statement for memory table update like this in Magic XPA 3.2d RIA

1-I have 10 field in a table

                i want to create a single statement for update all field of the table.

·         Table(WeekDetail)

1.       SrNo

2.       Week1

3.       Week2

4.       Week3

5.       Week4

6.       Week5

7.       Week6

8.       Week7

9.       Week8

10.   Week9 

I want to update like this

Create a virtual     nCounter, nWeek

                While Loop nCounter<=10

                        Upd       nCounter =  nCounter+1

                        Upd       nWeek =  nWeek +1

                                call Sub Task 1

in sub Task (Batch Program)

Link Write           1             Week Detail      Index    1

       Colum 1          SrNo      Locate: 1     To: 1      Init: 1

                in Record Suffix

 i.e   Update  (Tbl Constructed) Variable  trim('Week')&Counter  With  nWeek

And it should update appropriate column based on constructed Column

Result

 SrNo  Week1  Week2  Week3  Week4  Week5  Week6  Week7  Week8  Week9  

1            1             2            3              4             5           6             7           8             9


Harry Kleinsmit
 

Hi Madhav,

You can use the functions VarSet() and VarCurr() for that purpose. See the manual (F1) on how to use them.
Sample on how to update a variable including it current content (add to it):
VarSet('X'VAR+Counter(0), VarCurr('X'VAR+Counter(0)) + Counter(0) )

Best regards,
Harry Kleinsmit.


Madhav saran
 

I want to know how to update table all column with one virtual in above case . 
I dont Want to create more than one variable for tbl update .
thanks


On Thu, Aug 30, 2018 at 1:32 PM <harry@...> wrote:
Hi Madhav,

You can use the functions VarSet() and VarCurr() for that purpose. See the manual (F1) on how to use them.
Sample on how to update a variable including it current content (add to it):
VarSet('X'VAR+Counter(0), VarCurr('X'VAR+Counter(0)) + Counter(0) )

Best regards,
Harry Kleinsmit.


Madhav saran
 

This is possible when i am using DirectSql  but DirectSql will only with DataBase Tbl not with Mem 
like this
'UPDATE  WeekDetail     SET      Week1 =1 and  Week2 =2 and  Week3 =3 ..........WHERE SrNo = 1
but is their any possibility to update memory table like this statement 
thanks


On Thu, Aug 30, 2018 at 1:42 PM Madhav saran <saran.madhav873@...> wrote:
I want to know how to update table all column with one virtual in above case . 
I dont Want to create more than one variable for tbl update .
thanks


On Thu, Aug 30, 2018 at 1:32 PM <harry@...> wrote:
Hi Madhav,

You can use the functions VarSet() and VarCurr() for that purpose. See the manual (F1) on how to use them.
Sample on how to update a variable including it current content (add to it):
VarSet('X'VAR+Counter(0), VarCurr('X'VAR+Counter(0)) + Counter(0) )

Best regards,
Harry Kleinsmit.


Andreas Sedlmeier
 

There's no SQL for memory tables, memory db can however be result database for direct SQL. You can use SQLite which is effectively a memory database too. I am just not a big RIA fan and therefore not sure (for memory tables neither) if you can have that DB file on client side in case of RIA. If your resultset is really dynamic (varying number of columns) you could also work with vectors to store your week totals - or with XML Blobs and XML direct access. Problem will then just be the display in a table/grid control. You could use a .NET grid control for that. Possibilities for varying number of columns with Magic table controls is limited.

Andreas