× Discuss on Template programming, jBASE programming, Enquiries, No-File enquiry, Enquiry routines, Version, Version routines, Menus, Abbriviations, Creating local reference fields, Fast path enquiries, Creating charts and graphs, Generating Reports, Deal slips, Straight through processing, Multi Company and Multi Book setup, Tabbed screens, Composite Screens, T24 API, etc...

Deletion of MultiValue on version via routin

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10795 by arslan
Hi guys,

According to controls wich i've build,if needed i need to delete a multivalue field and own value on version. as i know we do add new multi field with routine (R.NEW(FIELDNO)<1,2>) but what is the way to delete multivalue field.

Thanks in advance.

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
12 years 11 months ago #10796 by jpb
DEL
Use the DEL statement to remove a specified element of a dynamic array.
COMMAND SYNTAX
DEL variable<expression1{, expression2{, expression3}}>
SYNTAX ELEMENTS
The variable can be any previously assigned variable or matrix element. The expressions must evaluate
to a numeric value or a runtime error will occur.
expression1 specifies the field in the array to operate upon and must be present.
expression2 specifies the multivalue within the field to operate upon and is an optional parameter.
expression3 is optionally present when expression2 has been included. It specifies which subvalue to
delete within the specified multivalue.
NOTES
Truncates non-integer values for any of the expressions to integers
Ignores invalid numeric values for the expressions without warning
The command operates within the scope specified, i.e. if specifying only a field then it deletes the
entire field (including its multivalues and subvalues). If specifying a subvalue, then it deletes only the
subvalue leaving its parent multivalue and field intact.
EXAMPLES
FOR I = 1 TO 20
Numbers<I> = I ;*generate numbers
NEXT I
FOR I = 19 TO 1 STEP –2
DEL Numbers<I> ;*remove odd numbers
NEXT I
The following user(s) said Thank You: arslan

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago - 12 years 11 months ago #10797 by arslan
thanks for repyling me but i tried it before and now it didnt work again.
i use the command like ;

DEL R.NEW(178)<1,95>
*178 is a local.ref field on application and 95 is a multivalu field.

and as a result there is no effect.

The porpuse of what i am doing is if the user increases the multivalue field (if added 3 multivalue filed to input value) on application according to my rule i may need to remove 2 of them and as a result on version i need to see just one field in multivalue field.

i will be waiting for your answer, thanks again in advence.
Last edit: 12 years 11 months ago by arslan.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago - 12 years 11 months ago #10798 by durai611
Hi,

DEL can be used only on dynamic array.
R.NEW is a dimensional array so it won't work.

Use MATBUILD to convert to dynamic array and do the same. It works.
Last edit: 12 years 11 months ago by durai611.
The following user(s) said Thank You: arslan

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
12 years 11 months ago #10799 by jpb
or use

my.dym = R.NEW(178)
DEL my.dym<1,95,x>
R.NEW(178) = my.dym
The following user(s) said Thank You: arslan

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10800 by durai611
Hope this will sure help you

R.NEW(178) = DELETE(R.NEW(178),1,95)
The following user(s) said Thank You: arslan

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10801 by arslan
Thanks for sharing ideas but ;

i did as what you said and here is the code what i coded.

LOCAL.FIELD = R.NEW(178)
DEL LOCAL.FIELD<1,95,3>
R.NEW(178) = LOCAL.FIELD

but this is not working too just deleting value into the field but i want to delete field. and by the way how can i use "MATBUILD" command ?

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago - 12 years 11 months ago #10802 by arslan
i've tried "R.NEW(178) = DELETE(R.NEW(178),1,95)" too but again just deleted value not field.
***by the way i am tring to do this action on validation routine and on the other side what is the button command of "remove multi / sub value " into routine?

what about that "MATBUILD" command, how can i use it?
Last edit: 12 years 11 months ago by arslan.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10803 by durai611
MATBUILD is used to build a dynamic array from a dimensional array

Syntax: MATBUILD my.dyn FROM R.NEW

After doing your changes again you can convert by using MATPARSE, command to build dimensional array from dynamic array

Syntax: MATPARSE R.NEW FROM my.dyn


I am little confused with your requirement. If you want to remove the multivalue then the above mentioned DELETE command & jpb suggestions works fine.

"but this is not working too just deleting value into the field but i want to delete field."
delete field means you want to remove all the values in that field? If yes, then just do R.NEW(178) = ''

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10804 by arslan
let me say that way;

if i click the insert multi / sub value button on the version after that command it will add the fields how much i clicked.

on the version that will seem as shown below;

178.95.1 Personal Number = 234
178.95.2 Personal Number = 456
178.95.3 Personal Number = 589
178.95.4 Personal Number = 100

on the another field a validation routine will run and check the rule.and after that the routine may remove some multi fields not values.you can see at below i want routine to do after run.

178.95.1 Personal Number = 234
178.95.2 Personal Number = 589

as you see routine will remove fields on the screen not just values of fields and when i tried your ways it seems on the screen like below

178.95.1 Personal Number = 234
178.95.2 Personal Number =
178.95.3 Personal Number =
178.95.4 Personal Number =

now could i explain clearly the porpuse of what i am tring to do ? and again thank you for your helps.i will be glad if i can get the solution.

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
12 years 11 months ago #10806 by jpb
Just a small question, do you call REBUILD.SCREEN at the end of your routine ???

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10807 by arslan
i didnt try this command but without this shouldnt it do it? but also i will try than inform you.

thanks.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10809 by durai611
Hi arslan,

Are you using Browser or Desktop?
I have checked in Browser and it's working fine.

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10810 by arslan
goodmornig and thanks for interest.

i am using desktop.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10813 by durai611
Sorry I don't have desktop version.

Give a try by calling REBUILD.SCREEN as jpb suggested.

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
12 years 11 months ago #10815 by jpb
@durai611 :

Do you have any doc about DELETE as function, I only know it as statement (for deleting records). It wasn't even listet in Universe ...?

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10816 by durai611
Dear jpb, Sorry I don't have any doc on this function. I have seen sometimes before using this function in a routine so that shared here.

Please Log in or Create an account to join the conversation.

More
12 years 11 months ago #10817 by Gigiipse
Perhaps not the most practical way but in lack of other solutions:

START.POS = INDEX(R.NEW(FIELDNO), @VM, 1)
END.POS = INDEX(R.NEW(FIELDNO), @VM, 2)
TOTAL.LENGHT = LEN(R.NEW(FIELDNO))
R.NEW(FIELDNO) = R.NEW(FIELDNO)[1,START.POS]:R.NEW(FIELDNO)[START.POS,TOTAL.LENGHT]

You may need to add an additional @VM, not sure. If field doen't disapear use START.POS -1

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
12 years 11 months ago - 12 years 11 months ago #10823 by jpb

File Attachment:

File Name: DELETEfunction.doc
File Size:28 KB

For those who are interested in :
Attachments:
Last edit: 12 years 11 months ago by jpb.

Please Log in or Create an account to join the conversation.

  • arslan
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
12 years 11 months ago #10827 by arslan
@jpb and @durai611 thank you so much for your helps.

at the end i got the solution with your helps. i read the deletefunction document and update the code and appended REBUILD.SCREEN code after that yes finalyy it worked :)

thanks again so much.

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds